Thanks for implementing this. It works great for checking the state of and setting the indicators on my Cooper RF9501 switches. However, the indicator on my RF9517’s indicator does not have an entity created. By turning on debug level logging, I was able to see the value_id in the log file and use that in my automations. I’m not sure if I need to worry about the value_id changing, but it’d be cleaner to use the entity indirectly reference the value_id.
Is there a specific component I should enable debug logging for & restart home assistant to help debug this? I had enabled debug for all, which was a pretty massive & spammy file
If the device has the indicator command class defined, it should create an entity for it. Looks like that is an accessory switch, and I don’t have that model. Without having one myself, I can’t really say if it is a bug or just needing to edit the zwcfg file for that device.
Looking at the zwcfg, I see the same CommandClass element with attribute id=“135”
The text is exactly the same, so I think the zwcfg contents can be ruled out.
My write up in another thread might be useful for people looking at this thread. It feels like I am doing some workarounds to make this scene controller function, but it seems to be working well.
Now that you’ve added the device, you should be able to find an entity called something like sensor.scene_contrl_indicator (something indicator). You’ll find it reports back a number. Each light on the controller matches up to one bit in that number, so if the top light is on, the number will be one. If the second one is also on, it’ll be three. Third one on also, you’ll have 7. So you can do a bitwise check on the indicator value to determine which lights are on.
In the Z-Wave settings for the scene controller, I associated group 255 to my Z-wave stick. I think this was a necessary step to receive an event (zwave.node_event) when the buttons were pressed, and not when they were just turned off? I don’t entirely remember.
I then made an AppDaemon script that listens for those "zwave.node_event"s and refreshes the indicator entity when they are received. You can see my script here, but note that I was lazy and hardcoded the entity id: https://pastebin.com/1PCXBE1V
Finally, I whipped up another AppDaemon script that listens for changes to the indicator entity and toggles a set of input_booleans appropriately (input_boolean.scene_switch[1-5]). On line 74, there’s a hardcoded node_id and value_id. The node_id is the Z-wave node ID, and the value ID should correspond to the indicator value, but I don’t remember how I found that value ID, or if it will be the same for you? Again, note that I hardcoded entity id’s in this script, so consider it more of a guideline: https://pastebin.com/iB80WMDb
From there, you can do whatever regular Home Assistant stuff you want on the input_booleans, and they should just update when you press the buttons on the scene control. Easy peasy!
I’m sure there are better ways to do this, but this was the way I opted to do it.
Thanks for writing this up! So I dont need to modify my zwcfg? Also, I’ve never done anything with AppDaemon scripts. Could you help me know what to do with those? Do I make these files and copy them in the config directory? I see the sensor.scene_contrl_indicator but it remains 0. I did associate all the buttons in the zwave settings to the z-wave stick. Should I just do 255 and not 1 - 5? I really appreciate you helping me with this I’ve been wanting to do this for a long time!
Oh yeah, I forgot about modifying the zwcfg. You’ll have to add in the COMMAND_CLASS_CENTRAL_SCENE stuff as in some of Blake’s posts above.
The indicator entity won’t refresh automatically, it has to be specifically asked to refresh (That’s what the first of my two scripts does, refreshes it when we see events saying that something has changed). As a test in the meantime, you’d be able to manually make the call to the service to update it, just to be sure that things are working right. In the services tab, you’d want to use the “zwave.refresh_entity” service, and specify your indicator sensor as the entity_id. Afterwards, you should see the correct value in it.
For the AppDaemon scripts, you’ll need to install AppDaemon (might be easier or harder depending on how you have HA installed, eg Hassio vs a regular install). You’d then want to make a file for each script in /config/appdaemon/apps/ (ZwaveEventListener.py and SceneControllerHandler.py). Then in /config/appdaemon/apps/apps.yaml you’d need to add the following to activate instances of the scripts:
To be honest, I thought I added associations for groups 1-5 as well, but it isn’t showing in my Z-Wave config. It probably wouldn’t hurt to do so.
In ZwaveEventListener.py you’d need to modify line 13 with the name of your zwave entity for the scene controller, and line 15 with your indicator entity.
In SceneControllerHandler.py:
-Lines 9, 23, update with your indicator entity
-Line 74 as mentioned, make sure it references the z-wave node id. The value_id may be fine as is?
-If you want to use other names for the individual switches, you’ll need to change all references to input_boolean.scene_switch_[1-5] to whatever you want.
I think that’s something to do with the formatting in your apps.yaml, IIRC.
“zwaveEventListener:” should have no spaces before it, and the next two lines should each be indented two spaces. Might have copied some funny blank characters that are getting misinterpreted
2019-02-06 21:37:50.999165 INFO AppDaemon Version 3.0.2 starting
2019-02-06 21:37:50.999568 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-02-06 21:37:51.001463 INFO AppDaemon: Starting Apps
2019-02-06 21:37:51.006395 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-02-06 21:37:51.094250 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-02-06 21:37:51.094824 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-02-06 21:37:51.095214 INFO Starting Dashboards
2019-02-06 21:37:51.102805 INFO API is disabled
2019-02-06 21:37:51.112876 INFO AppDaemon: HASS: Connected to Home Assistant 0.86.4
2019-02-06 21:37:51.199866 INFO AppDaemon: Got initial state from namespace default
2019-02-06 21:37:53.195880 INFO AppDaemon: Reading config
2019-02-06 21:37:53.202411 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-06 21:37:53.202658 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-06 21:37:53.202927 INFO AppDaemon: App 'hello_world' added
2019-02-06 21:37:53.203200 INFO AppDaemon: App 'zwaveEventListener' added
2019-02-06 21:37:53.203446 INFO AppDaemon: App 'sceneControllerHandler' added
2019-02-06 21:37:53.203829 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-02-06 21:37:53.204923 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/zwaveeventlistener.py - ignoring
2019-02-06 21:37:53.205146 WARNING AppDaemon: No app description found for: /config/appdaemon/apps/scenecontrollerhandler.py - ignoring
2019-02-06 21:37:53.205423 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-02-06 21:37:53.215528 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-02-06 21:37:53.314588 INFO hello_world: Hello from AppDaemon
2019-02-06 21:37:53.316225 INFO hello_world: You are now ready to run Apps!
2019-02-06 21:37:53.316400 INFO AppDaemon: Initializing app zwaveEventListener using class ZwaveEventListener from module ZwaveEventListener
2019-02-06 21:37:53.316623 WARNING AppDaemon: Unable to find module module ZwaveEventListener - zwaveEventListener is not initialized
2019-02-06 21:37:53.316769 INFO AppDaemon: Initializing app sceneControllerHandler using class SceneControllerHandler from module SceneControllerHandler
2019-02-06 21:37:53.316989 WARNING AppDaemon: Unable to find module module SceneControllerHandler - sceneControllerHandler is not initialized
2019-02-06 21:37:53.317732 INFO AppDaemon: App initialization complete
Another questions, when I look in the zwave log and press a button on the scene controller, should I see a message from that node - My scene controller node is 58, and when I press a button on it, I don’t see it displaying anything in the log.
The error messages look like you may have named the files in all lowercase. The capitalization is important in this case, so they should be “SceneControllerHandler.py” and “ZwaveEventListener.py”. Alternately you could modify the “module” lines to match the capitalization of the file names you’ve given them.
Did you shut down Z-Wave before modifying zwcfg? You should be able to see a message in the logs when you press the buttons, so if you aren’t seeing them, I suspect something isn’t set up right.
2019-02-06 21:42:20.261895 INFO AppDaemon Version 3.0.2 starting
2019-02-06 21:42:20.262209 INFO Configuration read from: /config/appdaemon/appdaemon.yaml
2019-02-06 21:42:20.263699 INFO AppDaemon: Starting Apps
2019-02-06 21:42:20.267393 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2019-02-06 21:42:20.350715 INFO AppDaemon: HASS: HASS Plugin Initializing
2019-02-06 21:42:20.351259 INFO AppDaemon: HASS: HASS Plugin initialization complete
2019-02-06 21:42:20.351644 INFO Starting Dashboards
2019-02-06 21:42:20.358897 INFO API is disabled
2019-02-06 21:42:20.368559 INFO AppDaemon: HASS: Connected to Home Assistant 0.86.4
2019-02-06 21:42:20.486812 INFO AppDaemon: Got initial state from namespace default
2019-02-06 21:42:22.448841 INFO AppDaemon: Reading config
2019-02-06 21:42:22.455251 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-06 21:42:22.455498 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified
2019-02-06 21:42:22.455775 INFO AppDaemon: App 'hello_world' added
2019-02-06 21:42:22.455980 INFO AppDaemon: App 'zwaveEventListener' added
2019-02-06 21:42:22.456159 INFO AppDaemon: App 'sceneControllerHandler' added
2019-02-06 21:42:22.456447 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2019-02-06 21:42:22.457462 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/SceneControllerHandler.py
2019-02-06 21:42:22.467480 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/hello.py
2019-02-06 21:42:22.468126 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ZwaveEventListener.py
2019-02-06 21:42:22.468799 INFO AppDaemon: Initializing app hello_world using class HelloWorld from module hello
2019-02-06 21:42:22.559851 INFO hello_world: Hello from AppDaemon
2019-02-06 21:42:22.561153 INFO hello_world: You are now ready to run Apps!
2019-02-06 21:42:22.561327 INFO AppDaemon: Initializing app zwaveEventListener using class ZwaveEventListener from module ZwaveEventListener
2019-02-06 21:42:22.562910 INFO zwaveEventListener: Listening for Z-Wave Events
2019-02-06 21:42:22.563201 INFO AppDaemon: Initializing app sceneControllerHandler using class SceneControllerHandler from module SceneControllerHandler
2019-02-06 21:42:22.564710 INFO sceneControllerHandler: Handling scene controller stuff
2019-02-06 21:42:22.565010 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_1 not found in AppDaemon
2019-02-06 21:42:22.565157 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_1 not found in AppDaemon
2019-02-06 21:42:22.593182 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_2 not found in AppDaemon
2019-02-06 21:42:22.593517 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_2 not found in AppDaemon
2019-02-06 21:42:22.613604 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_3 not found in AppDaemon
2019-02-06 21:42:22.613975 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_3 not found in AppDaemon
2019-02-06 21:42:22.634595 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_4 not found in AppDaemon
2019-02-06 21:42:22.634984 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_4 not found in AppDaemon
2019-02-06 21:42:22.701376 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_5 not found in AppDaemon
2019-02-06 21:42:22.701735 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_5 not found in AppDaemon
2019-02-06 21:42:22.729499 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_1 not found in AppDaemon
2019-02-06 21:42:22.730021 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_2 not found in AppDaemon
2019-02-06 21:42:22.730558 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_3 not found in AppDaemon
2019-02-06 21:42:22.730808 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_4 not found in AppDaemon
2019-02-06 21:42:22.731070 WARNING AppDaemon: sceneControllerHandler: Entity input_boolean.scene_switch_5 not found in AppDaemon
2019-02-06 21:42:22.732206 INFO AppDaemon: App initialization complete
You’ll need to create the input_booleans in your regular Home Assistant configuration.yaml. In my case, that would look like:
input_boolean:
scene_switch_1:
name: Scene Controller 1
initial: off
scene_switch_2:
name: Scene Controller 2
initial: off
scene_switch_3:
name: Scene Controller 3
initial: off
scene_switch_4:
name: Scene Controller 4
initial: off
scene_switch_5:
name: Scene Controller 5
initial: off