PatchworkBoy / homebridge-edomoticz

Domoticz Homebridge-Plugin
Other
118 stars 44 forks source link

push button #133

Closed theo-69 closed 6 years ago

theo-69 commented 6 years ago

How can I add my push button to homekit. How do i have to config them in domoticz.

what does "Push Switches - Domoticz SwitchTypeVal: 9" mean

PatchworkBoy commented 6 years ago

See https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s#Retrieve_status_of_specific_device SwitchTypeVal is given in the JSON output for that device.

In Domoticz, edit the switch and set it’s type to Push On

theo-69 commented 6 years ago

ok it shows 18 how do I change to 9??? I am a newbie

theo-69 commented 6 years ago

Got it however its not a button just a switch, are there any plans to include button with single and double click (function like the pop button)?

PatchworkBoy commented 6 years ago

Not that I’m aware of unless an existing homebridge plugin that covers that particular button can be found so I can see how it’s own characteristics map across to the Apple HomeKit spec.

If the button is detected incorrectly in Domoticz then nothing can be done. Homebridge only makes available what Domoticz makes available. Do the single and double click functions of the button work correctly in Domoticz? If not, you need to get the button functioning correctly in Domoticz before it’ll function correctly in homebridge, usually with custom lua scripts (eg: https://www.domoticz.com/forum/viewtopic.php?f=28&t=17305)

theo-69 commented 6 years ago

The Button does work in Domoticz, but shows at not compatible in HomeKit. This homebridge plugin (https://github.com/YinHangCode/homebridge-mi-aqara) does integrate button mit double and single click (even the one i have). Its integrated like a Logitech Pop Button or Hue Dimmer

PatchworkBoy commented 6 years ago

Ditto your socket post - I need Domoticz JSON API output for the button in each of it’s states (ie: JSON output for single click, JSON output for double etc) - see q/a section at https://www.domoticz.com/forum/viewtopic.php?f=36&t=10272

theo-69 commented 6 years ago

The json output would be:

{ "ActTime" : 1516742124, "ServerTime" : "2018-01-23 17:15:24", "Sunrise" : "06:35", "Sunset" : "18:02", "result" : [ { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 1.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 9, "Data" : "Off", "Description" : "", "Favorite" : 0, "HardwareID" : 12, "HardwareName" : "Aqara", "HardwareType" : "Xiaomi Gateway", "HardwareTypeVal" : 95, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "01A66841", "Image" : "Generic", "IsSubDevice" : false, "LastUpdate" : "2018-01-23 13:52:38", "Level" : 0, "LevelActions" : "||", "LevelInt" : 0, "LevelNames" : "Off|Click|Double Click", "LevelOffHidden" : false, "MaxDimLevel" : 100, "Name" : "Aquara Button", "Notifications" : "false", "PlanID" : "2", "PlanIDs" : [ 2 ], "Protected" : false, "SelectorStyle" : 0, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "Off", "StrParam1" : "", "StrParam2" : "", "SubType" : "Selector Switch", "SwitchType" : "Selector", "SwitchTypeVal" : 18, "Timers" : "false", "Type" : "Light/Switch", "TypeImg" : "Light", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "357" } ], "status" : "OK", "title" : "Devices" } its configured like this in Dashboard:

screenshot_79
PatchworkBoy commented 6 years ago

I need to see the different Status: messages for the switch in each of it’s states.

theo-69 commented 6 years ago

okay that Click

{ "ActTime" : 1516742464, "ServerTime" : "2018-01-23 17:21:04", "Sunrise" : "06:35", "Sunset" : "18:02", "result" : [ { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 9, "Data" : "On", "Description" : "", "Favorite" : 0, "HardwareID" : 12, "HardwareName" : "Aqara", "HardwareType" : "Xiaomi Gateway", "HardwareTypeVal" : 95, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "01A66841", "Image" : "Generic", "IsSubDevice" : false, "LastUpdate" : "2018-01-23 17:20:53", "Level" : 10, "LevelActions" : "||", "LevelInt" : 10, "LevelNames" : "Off|Click|Double Click", "LevelOffHidden" : false, "MaxDimLevel" : 100, "Name" : "Aquara Button", "Notifications" : "false", "PlanID" : "2", "PlanIDs" : [ 2 ], "Protected" : false, "SelectorStyle" : 0, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "Selector Switch", "SwitchType" : "Selector", "SwitchTypeVal" : 18, "Timers" : "false", "Type" : "Light/Switch", "TypeImg" : "Light", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "357" } ], "status" : "OK", "title" : "Devices" }

and thats double click

{ "ActTime" : 1516742545, "ServerTime" : "2018-01-23 17:22:25", "Sunrise" : "06:35", "Sunset" : "18:02", "result" : [ { "AddjMulti" : 1.0, "AddjMulti2" : 1.0, "AddjValue" : 0.0, "AddjValue2" : 0.0, "BatteryLevel" : 255, "CustomImage" : 9, "Data" : "On", "Description" : "", "Favorite" : 0, "HardwareID" : 12, "HardwareName" : "Aqara", "HardwareType" : "Xiaomi Gateway", "HardwareTypeVal" : 95, "HaveDimmer" : true, "HaveGroupCmd" : true, "HaveTimeout" : false, "ID" : "01A66841", "Image" : "Generic", "IsSubDevice" : false, "LastUpdate" : "2018-01-23 17:22:13", "Level" : 20, "LevelActions" : "||", "LevelInt" : 20, "LevelNames" : "Off|Click|Double Click", "LevelOffHidden" : false, "MaxDimLevel" : 100, "Name" : "Aquara Button", "Notifications" : "false", "PlanID" : "2", "PlanIDs" : [ 2 ], "Protected" : false, "SelectorStyle" : 0, "ShowNotifications" : true, "SignalLevel" : "-", "Status" : "On", "StrParam1" : "", "StrParam2" : "", "SubType" : "Selector Switch", "SwitchType" : "Selector", "SwitchTypeVal" : 18, "Timers" : "false", "Type" : "Light/Switch", "TypeImg" : "Light", "Unit" : 1, "Used" : 1, "UsedByCamera" : false, "XOffset" : "0", "YOffset" : "0", "idx" : "357" } ], "status" : "OK", "title" : "Devices" }

PatchworkBoy commented 6 years ago

Leave it with me... but it won’t be anytime in the near future as I’m flat out with other things at the moment. Will attempt to add support in the next update, whenever that may be.

theo-69 commented 6 years ago

Cool Thanks great!!!

PatchworkBoy commented 6 years ago

For my reference purposes: https://github.com/YinHangCode/homebridge-mi-aqara/blob/master/parser/ButtonParser.js

PatchworkBoy commented 6 years ago

See https://www.domoticz.com/forum/viewtopic.php?f=36&t=22015&p=169677#p169677

PatchworkBoy commented 6 years ago

Done - https://github.com/PatchworkBoy/homebridge-edomoticz/commit/7fd4dbf0206a0c2324a9d5264fef541862776643

pi@domoticz ~/ $ sudo npm update -g homebridge-edomoticz
/usr/local/lib
└── homebridge-edomoticz@2.1.6 
theo-69 commented 6 years ago

Thanks for your work, however I have a strange behaving. I does not matter how i click (single, double, long) it always triggered first long press and then single click in HomeKit (within 1 second) So it always only triggers single click.

screenshot_83
PatchworkBoy commented 6 years ago

Should be fixed by https://github.com/PatchworkBoy/homebridge-edomoticz/commit/ed2e7a707e6feae35105e185887e9ed93bf8b1db

pi@domoticz ~/ $ sudo npm update -g homebridge-edomoticz
/usr/local/lib
└── homebridge-edomoticz@2.1.9

Test & confirm...

theo-69 commented 6 years ago

did that still same also with another button with only click and double click.

If you click single click long click is send to HomeKit If you click double click long click is send to HomeKit If you click long click long click is send to HomeKit twice

PatchworkBoy commented 6 years ago

Righty - one last attempt - https://github.com/PatchworkBoy/homebridge-edomoticz/commit/8266f82762c431a3e1c74eb1aacfe0aac490f32a

pi@domoticz ~/ $ sudo npm update -g homebridge-edomoticz
/usr/local/lib
└── homebridge-edomoticz@2.1.10
theo-69 commented 6 years ago

Working now with 2.1.10, thanks @PatchworkBoy