Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For ProgrammableSwitchEvent the nocache=1 dosent work #95

Open
dmoibm opened this issue Sep 12, 2022 · 6 comments
Open

For ProgrammableSwitchEvent the nocache=1 dosent work #95

dmoibm opened this issue Sep 12, 2022 · 6 comments

Comments

@dmoibm
Copy link

dmoibm commented Sep 12, 2022

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

@justme-1968
Copy link
Owner

what kind of device is this in fhem?

@dmoibm
Copy link
Author

dmoibm commented Sep 12, 2022

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

@justme-1968
Copy link
Owner

justme-1968 commented Sep 17, 2022

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.

@dmoibm
Copy link
Author

dmoibm commented Sep 25, 2022

default=XX has no effect. How long is a while?
Caching states for StatelessProgrammableSwitch, as the name suggests, is useless.

@justme-1968
Copy link
Owner

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.

@normen
Copy link

normen commented Apr 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants