alexander-vitishchenko / hc3-to-mqtt

Fibaro HC3 integration with Home Assistant & NodeRed
MIT License
31 stars 13 forks source link

Problems with devices of type remoteSceneController #7

Closed japalie closed 3 years ago

japalie commented 3 years ago

I like the application very much. But i would like to ask if it is possible to add the remoteSceneController device Support to the App.

I tried to integrate it in the Code but I am stuck by missing knowledge about LUA and the System. I added the following lines to the file device_api (Line 96):

`----------------------------------- -- CentralSceneEvent

Scene = inheritFrom(PrototypeDevice) Scene.bridgeType = "scene" Scene.bridgeBinary = true Scene.bridgeMultilevel = false Scene.bridgeRead = true Scene.bridgeWrite = true

function Scene.isSupported(fibaroDevice) if (fibaroDevice.baseType == "com.fibaro.remoteSceneController" or fibaroDevice.type == "com.fibaro.remoteController") then return true else return false end end` and added it at line 417.

The Debug Log shows me a warning: [WARNING] [QUICKAPP46]: TBD: Need to introduce new event type for CentralSceneEvent

I added a line in the "main" file to see what the variable "event.data" shows in the output: [WARNING] [QUICKAPP46]: {"keyId":1,"id":25,"keyAttribute":"Pressed","icon":{"path":"assets\/icon\/fibaro\/com.fibaro.FGPB101_white\/com.fibaro.FGPB101-1Pressed_white.png","source":"HC"}}

I have here the API output of the devices, may it could help: {"id":32,"name":"Taste1","roomID":219,"view":[],"type":"com.fibaro.remoteController","baseType":"com.fibaro.actor","enabled":true,"visible":true,"isPlugin":false,"parentId":30,"viewXml":false,"configXml":false,"interfaces":["battery","zwave","zwaveMultiChannelAssociation","zwaveWakeup"],"properties":{"parameters":[],"pollingTimeSec":0,"wakeUpTime":0,"zwaveCompany":"AEON Labs","zwaveInfo":"3,4,62","zwaveVersion":"2.3","batteryLevel":69,"batteryLowNotification":true,"categories":["remotes"],"configured":true,"dead":false,"deadReason":"","defInterval":0,"deviceControlType":0,"deviceIcon":103,"emailNotificationID":0,"emailNotificationType":0,"endPointId":1,"log":"","logTemp":"","manufacturer":"","markAsDead":true,"maxInterval":0,"minInterval":0,"model":"","nodeId":4,"parametersTemplate":"0","pendingActions":false,"productInfo":"0,134,0,2,0,130,2,3","pushNotificationID":0,"pushNotificationType":0,"saveLogs":true,"serialNumber":"","smsNotificationID":0,"smsNotificationType":0,"stepInterval":0,"useTemplate":true,"userDescription":""},"actions":{"reconfigure":0,"setInterval":1},"created":1628863086,"modified":1628863086,"sortOrder":14}

{"id":25,"name":"Zentral Aus","roomID":219,"view":[],"type":"com.fibaro.FGPB101","baseType":"com.fibaro.remoteSceneController","enabled":true,"visible":true,"isPlugin":false,"parentId":24,"viewXml":false,"configXml":false,"interfaces":["battery","fibaroFirmwareUpdate","zwave","zwaveAlarm","zwaveCentralScene","zwaveMultiChannelAssociation","zwaveWakeup"],"properties":{"parameters":[{"id":1,"lastReportedValue":127,"lastSetValue":127,"size":1,"value":127},{"id":3,"lastReportedValue":7,"lastSetValue":7,"size":1,"value":7},{"id":10,"lastReportedValue":3,"lastSetValue":3,"size":1,"value":3},{"id":11,"lastReportedValue":255,"lastSetValue":255,"size":2,"value":255},{"id":12,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":13,"lastReportedValue":99,"lastSetValue":99,"size":2,"value":99},{"id":14,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":15,"lastReportedValue":255,"lastSetValue":255,"size":2,"value":255},{"id":20,"lastReportedValue":3,"lastSetValue":3,"size":1,"value":3},{"id":21,"lastReportedValue":255,"lastSetValue":255,"size":2,"value":255},{"id":22,"lastReportedValue":1,"lastSetValue":1,"size":1,"value":1},{"id":23,"lastReportedValue":99,"lastSetValue":99,"size":2,"value":99},{"id":24,"lastReportedValue":0,"lastSetValue":0,"size":1,"value":0},{"id":25,"lastReportedValue":255,"lastSetValue":255,"size":2,"value":255},{"id":29,"lastReportedValue":3,"lastSetValue":3,"size":1,"value":3},{"id":30,"lastReportedValue":127,"lastSetValue":127,"size":1,"value":127}],"pollingTimeSec":0,"wakeUpTime":0,"zwaveCompany":"Fibargroup","zwaveInfo":"3,4,38","zwaveVersion":"3.2","alarmLevel":0,"alarmType":0,"batteryLevel":100,"batteryLowNotification":true,"categories":["remotes"],"centralSceneSupport":[{"keyAttributes":["Pressed","Released","HeldDown","Pressed2","Pressed3","Pressed4","Pressed5"],"keyId":1}],"configured":true,"dead":false,"deadReason":"","defInterval":0,"deviceControlType":0,"deviceIcon":115,"emailNotificationID":0,"emailNotificationType":0,"endPointId":0,"firmwareUpdate":{"info":"","progress":0,"status":"UpToDate","updateVersion":"3.2"},"icon":{"path":"assets/icon/fibaro/com.fibaro.FGPB101_white/com.fibaro.FGPB101_white.png","source":"HC"},"log":"","logTemp":"","manufacturer":"","markAsDead":true,"maxInterval":0,"minInterval":0,"model":"","nodeId":2,"panicMode":false,"parametersTemplate":"772","pendingActions":false,"productInfo":"1,15,15,1,16,0,3,2","pushNotificationID":0,"pushNotificationType":0,"saveLogs":true,"sequences":[],"serialNumber":"h'000000000001d077","smsNotificationID":0,"smsNotificationType":0,"stepInterval":0,"updateVersion":"","useTemplate":true,"userDescription":""},"actions":{"abortUpdate":1,"reconfigure":0,"retryUpdate":1,"setInterval":1,"startUpdate":1,"updateFirmware":1},"created":1628863086,"modified":1628863086,"sortOrder":7}

for my pourposes it would be enough if i have a json output of the variable "event.data".

Thank you for your help.

alexander-vitishchenko commented 3 years ago

Hi @japalie,

You bring a good question, as I initially planned to add remoteSceneController support.

It is pretty straightforward how CentralSceneEvent to be captured on Fibaro Home Center 3 side... but then how do you envision it to be processed by Home Assistant side exactly? What is your end goal for this integration (possibly few use-case examples?), so I can elaborate on several functional design options and we choose which one is best.

Do you need this integration asap? I'm working on Energy/Power API support, which may take few weekends to get it done, and then get back to your request.

alexander-vitishchenko commented 3 years ago

Pease let me know if the request is still actual, or could be closed?

japalie commented 3 years ago

Sorry for my late reply.

I do not need the remoteSceneController for the Home Assistant, i use Node-Red as KNX Bridge. The Home Center is only there to connect Wireless Components like "Z-Wave WallMote Quad", "The Button", Fire Detectors and Motion Sensors to the Wired world.

For me the integration of that feature is not very urgent. I found a dirty solution arround that. I uploaded the changes in a Fork: https://github.com/japalie/hc3-to-mqtt/tree/master/src

I accomplished to create a new bridge type "scene" wich will push a json converted string out of the variable event. So can i check in Node-Red wich key is pressed and how long. For "The Button" i read the Value of event.value.data.keyAttribute And for the "WallMote Quad" it is the Value of event.value.data.keyId

May it will help you to create a nicer solution for it. If it is needed by more people than only me.

alexander-vitishchenko commented 3 years ago

@japalie

Some good news - I’m planning to switch to your request implementation next weekend, as I’m almost done with my other feature request for new Energy API.

My intention is to implement remote scene controller support for as much use cases as possible, including yours.

Can you please advise what zwave device do you use as remote scene controller… “Fibaro KeyFob” or “Aeon Minimote Remote Control”? It would be perfect, because I have both of them at home, so I can implement and test functionality relatively quick!

If you use different remote scene controller… then it would be great to get it from you, or buy a new one.

If not possible - I’ll be using your device config from above + do some reverse engineering of your code https://github.com/japalie/hc3-to-mqtt/tree/master/src. Then you help me with testing, hopefully it won’t take many iterations for us to get it done :-)

P.S.: it is 1am at Kyiv and I got quite sleepy, which is why I’ve edited this message after realising that you have provided your device config already. Still, having a real device would be the best. And by the way I’m also dreaming about having my smart home work with KNX devices some day, so maybe I can use my/your own implementation in a future :-)

alexander-vitishchenko commented 3 years ago

@japalie is the request still relevant for you?

I need either having a physical device or your support to test the new implementation.

alexander-vitishchenko commented 3 years ago

Hi @japalie

I've just implemented Remote Controller device support, where it is represented as text sensor with the recently pressed button (with auto-expiring value in 10 seconds).

I've also implemented passwordless mode to access Fibaro HC3. So you can remove these two redundant QA variables - "hc3Username" and "hc3Password"

Feel free to check it out and let me know if you need anything else!