ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
66 stars 27 forks source link

Missing support for GDC #59

Closed TimE90 closed 6 years ago

TimE90 commented 7 years ago

Hey,

thanks for this great homebridge plugin 👍

Could you please add support for Aeon Garage Door Controller. It's type of com.fibaro.barrier.

Open, Close, Status. So we can use: "Hey Siri, is the garage door open?" or "Hey Siri, please open the garage door".

Thanks in advance!

Best Regards Tim

ilcato commented 7 years ago

In order to add support to a new device you must implement additional code into the plugin.

Andreasjohansen commented 6 years ago

What additional code has to be implemented to the plugin? Would love to open the garage door with Siri:)

ilcato commented 6 years ago

Not a lot, but without a real device to test it's difficult to code.

Andreasjohansen commented 6 years ago

Could you give it a go?

ilcato commented 6 years ago

Are you able to support me? Do you have the device?

Andreasjohansen commented 6 years ago

I have the device Yes, but dont know a lot about coding. As long as you will guide me in helping you it will be ok😊

ilcato commented 6 years ago

Let start this way:

Andreasjohansen commented 6 years ago

{ "id": 294, "name": "294", "roomID": 0, "type": "com.fibaro.zwaveDevice", "baseType": "com.fibaro.device", "enabled": true, "visible": false, "isPlugin": false, "parentId": 1, "remoteGatewayId": 0, "interfaces": [ "polling", "zwave", "zwaveAssociation", "zwaveConfiguration", "zwaveSecurity", "zwaveSlaveRouting" ], "properties": { "associations": "[{\"endPointId\":0,\"groups\":[{\"groupInfo\":{\"commands\":[{\"command\":\"Basic Report\",\"commandClass\":\"Command Class Basic\"},{\"command\":\"Hail\",\"commandClass\":\"Command Class Hail\"},{\"command\":\"Configuration Report\",\"commandClass\":\"Command Class Configuration\"},{\"command\":\"Notification Report\",\"commandClass\":\"Command Class Notification\"},{\"command\":\"Barrier Operator Report\",\"commandClass\":\"Command Class Barrier Operator\"}],\"name\":\"Lifeline\",\"profile\":\"General: Not Applicable\"},\"id\":1,\"singleChannel\":{\"max\":5,\"set\":[1],\"view\":[1]}},{\"groupInfo\":{\"commands\":[{\"command\":\"Switch Binary Set\",\"commandClass\":\"Command Class Switch Binary\"},{\"command\":\"Basic Set\",\"commandClass\":\"Command Class Basic\"}],\"name\":\"transmit\",\"profile\":\"General: Not Applicable\"},\"id\":2,\"singleChannel\":{\"max\":5,\"set\":[],\"view\":[]}}]},{\"endPointId\":0,\"groups\":[{\"groupInfo\":{\"commands\":[{\"command\":\"Basic Report\",\"commandClass\":\"Command Class Basic\"},{\"command\":\"Hail\",\"commandClass\":\"Command Class Hail\"},{\"command\":\"Configuration Report\",\"commandClass\":\"Command Class Configuration\"},{\"command\":\"Notification Report\",\"commandClass\":\"Command Class Notification\"},{\"command\":\"Barrier Operator Report\",\"commandClass\":\"Command Class Barrier Operator\"}],\"name\":\"Lifeline\",\"profile\":\"General: Not Applicable\"},\"id\":1,\"singleChannel\":{\"max\":5,\"set\":[1],\"view\":[1]}},{\"groupInfo\":{\"commands\":[{\"command\":\"Switch Binary Set\",\"commandClass\":\"Command Class Switch Binary\"},{\"command\":\"Basic Set\",\"commandClass\":\"Command Class Basic\"}],\"name\":\"transmit\",\"profile\":\"General: Not Applicable\"},\"id\":2,\"singleChannel\":{\"max\":5,\"set\":[],\"view\":[]}}]}]", "configured": false, "dead": "false", "deviceControlType": "0", "deviceIcon": "28", "deviceSpecificData": "h'0a000100010106030400000009090200000000", "deviceSpecificIdType": "Serial Number", "deviceState": "NotConfigured", "emailNotificationID": "0", "emailNotificationType": "0", "endPointId": "0", "liliOffCommand": "", "liliOnCommand": "", "log": "Not configured", "logTemp": "TxtBlue", "manufacturer": "", "markAsDead": "true", "model": "", "nodeId": "66", "parameters": [ { "id": 41, "lastReportedValue": 15, "lastSetValue": 15, "size": 1, "value": 15 }, { "id": 36, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 } ], "parametersTemplate": "0", "pollingInterval": "0", "pollingTimeSec": 0, "productInfo": "0,134,0,3,0,62,1,11", "pushNotificationID": "0", "pushNotificationType": "0", "remoteGatewayId": "0", "saveLogs": "true", "securitySchemes": "[]", "serialNumber": "h'0a000100010106030400000009090200000000", "smsNotificationID": "0", "smsNotificationType": "0", "useTemplate": "false", "userDescription": "", "zwaveCompany": "AEON Labs", "zwaveInfo": "3,3,99", "zwaveSoftwareVersion": "{}", "zwaveVersion": "1.11" }, "actions": { "getParameter": 1, "poll": 0, "reconfigure": 0, "setParameter": 2 }, "created": 1516900653, "modified": 1516900653, "sortOrder": 151 }

Andreasjohansen commented 6 years ago

{ "id": 295, "name": "Garasjeport", "roomID": 17, "type": "com.fibaro.barrier", "baseType": "com.fibaro.actor", "enabled": true, "visible": true, "isPlugin": false, "parentId": 294, "remoteGatewayId": 0, "interfaces": [ "fibaroFirmwareUpdate", "zwave", "zwaveAlarm", "zwaveSubsystem" ], "properties": { "parameters": [ { "id": 41, "lastReportedValue": 15, "lastSetValue": 15, "size": 1, "value": 15 }, { "id": 36, "lastReportedValue": 1, "lastSetValue": 1, "size": 1, "value": 1 } ], "pollingTimeSec": 0, "zwaveCompany": "AEON Labs", "zwaveInfo": "3,3,99", "zwaveVersion": "1.11", "alarmLevel": "0", "alarmType": "0", "configured": false, "dead": "false", "deviceControlType": "0", "deviceIcon": "104", "emailNotificationID": "0", "emailNotificationType": "0", "endPointId": "0", "firmwareUpdate": "{\"info\":\"\",\"progress\":0,\"status\":\"UpToDate\",\"updateVersion\":\"1.11\"}", "liliOffCommand": "", "liliOnCommand": "", "log": "Not configured", "logTemp": "TxtBlue", "manufacturer": "", "markAsDead": "true", "model": "", "nodeId": "66", "parametersTemplate": "0", "productInfo": "0,134,0,3,0,62,1,11", "pushNotificationID": "0", "pushNotificationType": "0", "remoteGatewayId": "0", "saveLogs": "true", "serialNumber": "h'0a000100010106030400000009090200000000", "smsNotificationID": "0", "smsNotificationType": "0", "state": "Closed", "subsystems": "[{\"name\":\"Visual Notification\",\"state\":\"On\",\"type\":2},{\"name\":\"Unknown\",\"state\":\"unknown\",\"type\":3}]", "updateVersion": "", "useTemplate": "false", "userDescription": "" }, "actions": { "abortUpdate": 1, "close": 0, "open": 0, "reconfigure": 0, "retryUpdate": 1, "setAllSubsystems": 1, "startUpdate": 1, "updateFirmware": 1 }, "created": 1516900653, "modified": 1516900653, "sortOrder": 152 }

Andreasjohansen commented 6 years ago

sorry, it was the hidden ID of the device you got first..

ilcato commented 6 years ago

Thankyou @Andreasjohansen. Can you also send me a screenshot of the UI of Fibaro Home Center corresponding to the device?

Andreasjohansen commented 6 years ago

9d46a3eb-4744-4d3f-8ad8-58b66db3c92d

Andreasjohansen commented 6 years ago

Like that? Or am I just stupid..?

ilcato commented 6 years ago

Perfect. I will try a first draft tomorrow.

Andreasjohansen commented 6 years ago

Awesome:)

ilcato commented 6 years ago

@Andreasjohansen, I just committed on Github a first draft of the plugin with a support for GDC status (not yet the actions). Are you able to test it with your device?

Andreasjohansen commented 6 years ago

Later today when i come home from work :)

ilcato commented 6 years ago

Ok, just added also the actions part. Give me a feedback later.

ilcato commented 6 years ago

@TimE90 are you also able to test it?

TimE90 commented 6 years ago

Yes, will try it now… Thanks in advance!

TimE90 commented 6 years ago
pi@raspberrypi:/usr/lib/node_modules/homebridge-fibaro-hc2 $ npm ls
homebridge-fibaro-hc2@2.0.7 /usr/lib/node_modules/homebridge-fibaro-hc2

But new gdc code is not visible in src/ files… updated via "npm update…"?

ilcato commented 6 years ago

@TimE90, you need to manually upgrade the plugin. Replace the following files from GitHub to your installation: dist/shadows.js, dist/getFunctions.js and dist/setFunctions.js and restart homebridge.

Backup the previous ones in case of malfunctioning.

TimE90 commented 6 years ago

Yap, it just works. But (in my case) with a little exception. HomeKit says it's OPEN while garage door is CLOSED.

` getCurrentDoorState(callback, characteristic, service, IDs, properties) {

I think this.hapCharacteristic.TargetHeatingCoolingState.CLOSED and this.hapCharacteristic.TargetHeatingCoolingState.OPEN are the wrong return values. Even if I change the function to always return CLOSED/OPEN HomeKit always shows "OPEN".

What do you think?

TimE90 commented 6 years ago

After changing getCurrentDoorState to: getCurrentDoorState(callback, characteristic, service, IDs, properties) { this.returnValue(properties.state == "Closed" ? 1 : 0, callback, characteristic); } it just works!

And for setting change to: setTargetDoorState(value, callback, context, characteristic, service, IDs) { var action = value == 1 ? "close" : "open"; this.command(action, 0, service, IDs); }

ilcato commented 6 years ago

@TimE90 you are right. In the get function I used the wrong constant because of a copy paste and in the set function I didn't know the kind of values return by homekit. I just committed the changes. Can you retest ?

TimE90 commented 6 years ago

Yap, the new constants are working! Thanks for implementation (Y)

ilcato commented 6 years ago

Let's wait for @Andreasjohansen test and then I will publish on pm the new version. How do you command the GDC via Siri?

TimE90 commented 6 years ago

In German: "Hey Siri, öffne/schließe das Garagentor" In English: "Hey Siri, open/close the garage door"

ilcato commented 6 years ago

ok, can you also ask for the status?

TimE90 commented 6 years ago

"Ist das Garagentor offen" / "Ist das Garagentor geschlossen"… it works fine!

TimE90 commented 6 years ago

BTW: We use RGBW stripes in Fibaro… I think HomeKit now supports RGBW type? Could you add the W color?

Andreasjohansen commented 6 years ago

My homebridge crashes when I add those 3 files. what have i done wrong?

Andreasjohansen commented 6 years ago

Now it kind of works, but it just says closing in HomeKit, never closed. But when the door is open it says open..

ilcato commented 6 years ago

@TimE90, what about you? Does it say closed or closing?

ilcato commented 6 years ago

@Andreasjohansen , @TimE90 I just modified the dist/setFunctions.js file. Can you retest in order to verify that the closed status is reflected in the Home app?

TimE90 commented 6 years ago

Correct status for me :)

ilcato commented 6 years ago

@TimE90, with or without the change I made this morning?

Andreasjohansen commented 6 years ago

It works for me now. Thank you so much!