I’m trying to set up HA with a ZWave network, but I can’t get my battery wall switch to work to my liking (ZWave.me 064435). It has a paddle that I can press ‘on’ or ‘off’. Pressing ‘on’ sends a BASIC signal with value 255, ‘off’ sends the same signal with value 0.
I’ve managed to get it to register by updating components/zwave.py
(badly - see below).
HA can correctly see the switch sending ‘on’ and ‘off’ events. When I tap the switch, it registers that the state changes to ‘on’ (255) and the track_state_change
handler is correctly executed.
However, when I tap it again (‘on’), the event arrives in HA (in components/switch/zwave.py
in _value_changed(self, value)
, but since the value did not actually change (255 -> 255), it never arrives in the track_state_change
handler.
What I would like is to have the ‘on’ button cycle through different scenes.
Is something like that possible?
Below, my (makeshift) changes to get the switch to register:
# components/zwave.py
COMMAND_CLASS_BASIC = 32 # 0x20
# ...
DISCOVERY_COMPONENTS = [
# ...
('switch',
DISCOVER_SWITCHES,
[COMMAND_CLASS_SWITCH_BINARY,
COMMAND_CLASS_BASIC], # here
TYPE_WHATEVER, # here
GENRE_WHATEVER), # here
...
# components/switch/zwave.py
def setup_platform(hass, config,add_devices, discovery_info=None):
# Should of course be handled in a nicer way.
if value.command_class == zwave.COMMAND_CLASS_BASIC:
add_devices([ZwaveBasicSwitch(value)])
else
# Original code for adding switches
The ZwaveBasicSwitch
that I’ve created is just a subclass of ZwaveSwitch
with no extra functionality.
I’ve tried a (dirty!) workaround that overrides ZwaveBasicSwitch._value_changed(..)
and internally changes the 255-value to something new, but I could not get that to work.
I have also tried it as a Sensor
, which worked but with the same limitations.
I think my best bet is to use ZwaveTriggerSensor
(which has no memory and would trigger the track_state_change
handler), but that seems to temporarily set a high value and then automatically resets it to ‘0’ (which would correspond to an ‘off’ press on my switch).
Does anyone have an idea how I can add the switch and have the correct behavior for ‘on’ (multiple presses to cycle between programmes) and ‘off’ (turn off lights)?
Thanks!