For ProgrammableSwitchEvent the nocache=1 dosent work
Opened this issue · 6 comments
This is my definition in FHEM:
attr mydevicehomebridgeMapping clear ProgrammableSwitchEvent=click,nocache=true,values=single:SINGLE_PRESS;;;;double:DOUBLE_PRESS
But Homebridge only sends when the status has changed. However, this is rather pointless with ProgrammableSwitchEvent.
This is also adressed in #62 and #70
Thanks for suggestions and have a nice day.
Daniel
what kind of device is this in fhem?
It is a MQTT2_DEVICE. The message from MQTT is WISER/SCENE/ACTION/74:{`click‘:‘single‘}
I'll give you the whole fhem definition:
defmod MQTT2_WISER_SCENE_74 MQTT2_DEVICE WISER_SCENE_74
attr MQTT2_WISER_SCENE_74 alias Wozi4
attr MQTT2_WISER_SCENE_74 genericDeviceType StatelessProgrammableSwitch
attr MQTT2_WISER_SCENE_74 homebridgeMapping clear ProgrammableSwitchEvent=click,nocache=true,values=single:SINGLE_PRESS;;;;double:DOUBLE_PRESS
attr MQTT2_WISER_SCENE_74 readingList WISER/SCENE/ACTION/74:.* { json2nameValue($EVENT, '', $JSONMAP) }
attr MQTT2_WISER_SCENE_74 room Homebridge,MQTT2_DEVICE
attr MQTT2_WISER_SCENE_74 stateFormat click
nocache at the moment only influences the active retrieval of values from the homekit side and not the pushing of events from fhem.
please try with default=XX. this should reset the internal value after a while so that the new event will be used.
default=XX has no effect. How long is a while?
Caching states for StatelessProgrammableSwitch, as the name suggests, is useless.
sorry for the late answer...
i know what the problem is, but i have at the moment no idea how to fix it without a mayor rewrite of the event interface. i have to think some more... and no, it is not the caching.
Running into this issue too, I want my on/off switches to also emit StatelessProgramableSwitch
events so I can trigger automation when the light button is pressed, no matter its current state.
Edit: For now I did it with a workaround using a dummy and a watchdog, heres an attrTemplate
:
name:Add_Switches
#filter:TYPE=IT
desc: Adds StatelessProgrammableSwitches for on/off, set NAME and siriName beforehand!
order:20
par:SIRINAME;siri name;{AttrVal("DEVICE", "siriName", "noname")}
defmod DEVICE.on dummy
attr DEVICE.on genericDeviceType StatelessProgrammableSwitch
attr DEVICE.on homebridgeMapping ProgrammableSwitchEvent=state,values=on:SINGLE_PRESS;;orf:SINGLE_PRESS,nocache=1,timeout=1
attr DEVICE.on siriName SIRINAME On
attr DEVICE.on room IT_SWITCH
defmod DEVICE.on.notify notify DEVICE {if($EVENT eq "on"){ fhem "set DEVICE.on on" }}
attr DEVICE.on.notify room IT_SWITCH
defmod DEVICE.on.wd watchdog DEVICE.on:on 00:00:01 DEVICE.on:off setreading DEVICE.on state off
attr DEVICE.on.wd room IT_SWITCH
attr DEVICE.on.wd autoRestart 1
defmod DEVICE.off dummy
attr DEVICE.off genericDeviceType StatelessProgrammableSwitch
attr DEVICE.off homebridgeMapping ProgrammableSwitchEvent=state,values=on:SINGLE_PRESS;;orf:SINGLE_PRESS,nocache=1,timeout=1
attr DEVICE.off siriName SIRINAME Off
attr DEVICE.off room IT_SWITCH
defmod DEVICE.off.notify notify DEVICE {if($EVENT eq "off"){ fhem "set DEVICE.off on" }}
attr DEVICE.off.notify room IT_SWITCH
defmod DEVICE.off.wd watchdog DEVICE.off:on 00:00:01 DEVICE.off:off setreading DEVICE.off state off
attr DEVICE.off.wd room IT_SWITCH
attr DEVICE.off.wd autoRestart 1