This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Closed

Homey light switch not updated although reports are being received

RobinVanKekemRobinVanKekem Member
edited August 2016 in Archive
I'm able to switch the switch through Homey but the status of the switch in Homey isn't updated when the physical switch is used.
The reports being send by the physical switch are received but Homey doesn't understand them.

In driver.js I have
capabilities: {
onoff: 
[
{
command_class : 'COMMAND_CLASS_SWITCH_BINARY',
command_get : 'SWITCH_BINARY_GET',
command_set : 'SWITCH_BINARY_SET',
command_set_parser : value => {
return { 'Switch Value': value }
}
},
{
command_class : "COMMAND_CLASS_SWITCH_BINARY",
command_report : 'SWITCH_BINARY_REPORT',
command_report_parser : report => {
console.log(JSON.stringify(report));
return report['Value'] === 'on/enable';
},
pollInterval : "poll_interval"
} ]

Log output:
[debug] node.CommandClass['COMMAND_CLASS_SWITCH_BINARY'].on('report') arguments: { '0': { value: 3, name: 'SWITCH_BINARY_REPORT' },
  '1': { 'Value (Raw)': <Buffer ff>, Value: 'on/enable' },
  '2': null }
{"Value (Raw)":{"type":"Buffer","data":[255]},"Value":"on/enable"}
[debug] node.CommandClass['COMMAND_CLASS_SWITCH_BINARY'].on('report') arguments: { '0': { value: 3, name: 'SWITCH_BINARY_REPORT' },
  '1': { 'Value (Raw)': <Buffer 00>, Value: 'off/disable' },
  '2': null }
{"Value (Raw)":{"type":"Buffer","data":[0]},"Value":"off/disable"}

Full code:
https://github.com/inversion-nl/me.zwave

Comments

  • casedacaseda Member
    edited August 2016
    your report parse now always sends "on/enable" command to homey.
    my guess you will need to check first if it is on, or off:
    report => {
    console.log(JSON.stringify(report)); if( report['Value'][1] === 'on/enable' ) return report['Value'] === 'on/enable' : 'off/disable';
    },
    my mistake, the value is a sub value of "1":

    report => {
    console.log(JSON.stringify(report));
    return report[1]['Value'] === 'on/enable';
    },
  • I'm afraid that's not the problem.
    Else Homey would report the switch on all the time, and it doesn't.

    Tried your suggestion still not updating the state in Homey.

    Had to change the code a bit because Visual Studio gave an lint error.

    					command_report_parser	: report => {
    						console.log(JSON.stringify(report));
    						if( report['Value'][1] === 'on/enable' ) { 
    							return report['Value'] === 'on/enable';
    						} else return report['Value'] === 'off/disable';
    					}
  • And that works? because now it seems you switched the [1] and ['Value'] in the if state
  • Nope doesn't work. I'll test again tonight.
    Forgot to thank you for your time!
  • just keep this in mind, it needs to report a "true" or "false" (that is what it's doing with the " report['Value'] === 'on/enable'; "
    So you could try to do it this way:
    command_report_parser : report => {
    						console.log(JSON.stringify(report));
    						if( report[1]['Value'] === 'on/enable' ) { 
    							return true;
    						} else {
    							return false;
    						}
    					}
  • RobinVanKekemRobinVanKekem Member
    edited August 2016
    Did some testing.

    The default association group is default set to 3 times 0. Since Homey has ID 1, Homey did not receive any reports.
    After changing that I started receiving the reports when using the physical button, but only for the main device, not for channel 1 or 2.

    This device has 2 channels, ant Homey creates 3 devices, Domoticz did the same.

    I don't get any reports of the first and second channel, only for the main device.
    Anyone know how to do this?
  • Also Homey doesn't create an Insights log for the channels, only the main device.
  • @RobinVanKekem ;
    I don't think athom has implemented different endpoint yet,
    it should indeed create devices for all end points (this is 2 endpoints + the main device in your case)
    This will include them separately in insight as well.
    it did so in the previous Z-Wave, but now not just yet. (hopefully soon)
  • RobinVanKekemRobinVanKekem Member
    edited August 2016
    @caseda
    Thanks (again!)

    Any idea as to why Z-wave creates three devices?
    Domoticz also did this, I don't get why.
  • casedacaseda Member
    edited August 2016
    @RobinVanKekem ;;
    No problem.! :) that's why we have a forum

    well it could be possible with just one device, but i have not seen any devices having 2 (or 3) on/off buttons (or dimming bars) in 1 device card, with being able to properly say which one is which.
    So most controllers just include it as separate devices, and also because it's easier to handle as well.

    And it's three (and not just two) because you can turn them on (or off) at exactly the same time with the main controller (inside the device).
    you also need the one main controller to be able to send parameters etc.
  • I now only did a device for the main and channel 2, we'll see how it goes.  :)
    Have send a direct message to Jeroen Vollenbrock on Slack to ask if they have some undocumented code somewhere or I'll have to wait.
  • You are using multi instances i asume. Be aware that al instances show a settings page if you have implemented those, but only the main does allow these settings to be applied! So it can be the case that if you apply settings on a instance the app crashes. I've been talking with Emile about this and this has to be tackled in the future?
  • You are using multi instances i asume. Be aware that al instances show a settings page if you have implemented those, but only the main does allow these settings to be applied! So it can be the case that if you apply settings on a instance the app crashes. I've been talking with Emile about this and this has to be tackled in the future?
    Yes, noticed that.
    I'm already working on the multi instance reporting issue with Jeroen Vollenbrock.

    Did you create an Github issue for that?
    If not: I think you should so people can potentially now that the issue is there and being worked on.
This discussion has been closed.