diff --git a/app.json b/app.json index 9f8b4de..fdbe2d4 100644 --- a/app.json +++ b/app.json @@ -1,537 +1,532 @@ { - "id": "com.devolo", - "name": { - "en": "Devolo" - }, - "version": "1.0.1", - "compatibility": ">=0.9.3", - "description": { - "en": "Devolo z-wave devices for Homey" - }, - "category": [ - "appliances", - "lights" - ], - "images": { - "large": "/assets/images/large.png", - "small": "/assets/images/small.png" - }, - "author": { - "name": "Bram Oosterhuis", - "email": "bram.oosterhuis.nl@gmail.com" - }, - "contributors": { - "developers": [] - }, - "flow": { - "triggers": [{ - "id": "mt2652_btn1_single", - "title": { - "en": "Button 1 single press", - "nl": "Een maal gedrukt op knop 1" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn1_double", - "title": { - "en": "Button 1 double press", - "nl": "Twee maal gedrukt op knop 1" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn2_single", - "title": { - "en": "Button 2 single press", - "nl": "Een maal gedrukt op knop 2" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn2_double", - "title": { - "en": "Button 2 double press", - "nl": "Twee maal gedrukt op knop 2" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn3_single", - "title": { - "en": "Button 3 single press", - "nl": "Een maal gedrukt op knop 3" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn3_double", - "title": { - "en": "Button 3 double press", - "nl": "Twee maal gedrukt op knop 3" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn4_single", - "title": { - "en": "Button 4 single press", - "nl": "Een maal gedrukt op knop 4" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }, { - "id": "mt2652_btn4_double", - "title": { - "en": "Button 4 double press", - "nl": "Twee maal gedrukt op knop 4" - }, - "args": [{ - "name": "device", - "type": "device", - "filter": "driver_id=MT2652" - }] - }] - }, - "drivers": [ - { - "id": "MT2652", - "name": { - "en": "Devolo Scene Switch (Z-Wave Plus)" - }, - "zwave": { - "manufacturerId": 373, - "productTypeId": 256, - "productId": 257, - "learnmode": { - "image": "/drivers/MT2652/assets/learnmode.svg", - "instruction": { - "en": "Activate inclusion on the device by pressing any one of the four buttons for one second", - "nl": "Om paiting te activeren, druk langer een seconde op een van de knoppen van de schakelaar." - } - }, - "associationGroups": [ - 1, - 2, - 3, - 4, - 5 - ] - }, - "class": "light", - "capabilities": [ - "measure_battery" - ], - "images": { - "large": "/drivers/MT2652/assets/images/large.png", - "small": "/drivers/MT2652/assets/images/small.png" - }, - "settings": [ - { - "id": "button_1_and_3_pair_mode", - "type": "dropdown", - "label": { - "en": "Button 1 and 3 pair mode" - }, - "value": "1", - "hint": { - "en": "The parameter determines the behaviour of buttons 1 and 3." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Seperately, In separate mode button 1 works with control group A, button 3 with control group C. Click is On, Hold is dimming Up, Double click is Off, Click-Hold is dimming Down. " - } - }, { - "id": "1", - "label": { - "en": "(1) Pair without double clicks, In pair button A/C are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B and D" - } - }, { - "id": "2", - "label": { - "en": "(2) Pair with double clicks. In pair button A/C are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B,double click with group D" - } - }] - }, - { - "id": "button_2_and_4_pair_mode", - "type": "dropdown", - "label": { - "en": "Button 2 and 4 pair mode" - }, - "value": "1", - "hint": { - "en": "The parameter determines the behaviour of buttons 2 and 4." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Seperately, In separate mode button 2 works with control group B, button 4 with control group D. Click is On, Hold is dimming Up, Double click is Off, Click-Hold is dimming Down. " - } - }, { - "id": "1", - "label": { - "en": "(1) Pair without double clicks, In pair button B/D are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B and D" - } - }, { - "id": "2", - "label": { - "en": "(2) Pair with double clicks. In pair button B/D are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B,double click with group D" - } - }] - }, - { - "id": "command_to_control_group_a", - "type": "dropdown", - "label": { - "en": "Command to Control Group A" - }, - "value": "8", - "hint": { - "en": "This parameter defines the command to be sent to devices of control group A when the related button is pressed." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Disabled" - } - }, { - "id": "1", - "label": { - "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" - } - }, { - "id": "2", - "label": { - "en": "(3) Switch On/Off only (send Basic Set)" - } - }, { - "id": "3", - "label": { - "en": "(3) Switch All" - } - }, { - "id": "4", - "label": { - "en": "(4) Send Scenes" - } - }, { - "id": "5", - "label": { - "en": "(5) Send Preconfigured Scenes" - } - }, { - "id": "7", - "label": { - "en": "(7) Control DoorLock" - } - }, { - "id": "8", - "label": { - "en": "(8) Central Scene to Gateway (Default)" - } - }] - }, - { - "id": "command_to_control_group_b", - "type": "dropdown", - "label": { - "en": "Command to Control Group B" - }, - "value": "8", - "hint": { - "en": "This parameter defines the command to be sent to devices of control group B when the related button is pressed." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Disabled" - } - }, { - "id": "1", - "label": { - "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" - } - }, { - "id": "2", - "label": { - "en": "(3) Switch On/Off only (send Basic Set)" - } - }, { - "id": "3", - "label": { - "en": "(3) Switch All" - } - }, { - "id": "4", - "label": { - "en": "(4) Send Scenes" - } - }, { - "id": "5", - "label": { - "en": "(5) Send Preconfigured Scenes" - } - }, { - "id": "7", - "label": { - "en": "(7) Control DoorLock" - } - }, { - "id": "8", - "label": { - "en": "(8) Central Scene to Gateway (Default)" - } - }] - }, - { - "id": "command_to_control_group_c", - "type": "dropdown", - "label": { - "en": "Command to Control Group C" - }, - "value": "8", - "hint": { - "en": "This parameter defines the command to be sent to devices of control group C when the related button is pressed." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Disabled" - } - }, { - "id": "1", - "label": { - "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" - } - }, { - "id": "2", - "label": { - "en": "(3) Switch On/Off only (send Basic Set)" - } - }, { - "id": "3", - "label": { - "en": "(3) Switch All" - } - }, { - "id": "4", - "label": { - "en": "(4) Send Scenes" - } - }, { - "id": "5", - "label": { - "en": "(5) Send Preconfigured Scenes" - } - }, { - "id": "7", - "label": { - "en": "(7) Control DoorLock" - } - }, { - "id": "8", - "label": { - "en": "(8) Central Scene to Gateway (Default)" - } - }] - }, - { - "id": "command_to_control_group_d", - "type": "dropdown", - "label": { - "en": "Command to Control Group D" - }, - "value": "8", - "hint": { - "en": "This parameter defines the command to be sent to devices of control group D when the related button is pressed." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Disabled" - } - }, { - "id": "1", - "label": { - "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" - } - }, { - "id": "2", - "label": { - "en": "(3) Switch On/Off only (send Basic Set)" - } - }, { - "id": "3", - "label": { - "en": "(3) Switch All" - } - }, { - "id": "4", - "label": { - "en": "(4) Send Scenes" - } - }, { - "id": "5", - "label": { - "en": "(5) Send Preconfigured Scenes" - } - }, { - "id": "7", - "label": { - "en": "(7) Control DoorLock" - } - }, { - "id": "8", - "label": { - "en": "(8) Central Scene to Gateway (Default)" - } - }] - }, - { - "id": "send_the_following_switch_sll_commands", - "type": "dropdown", - "label": { - "en": "Switch All commands" - }, - "value": "1", - "hint": { - "en": "Send the following Switch All commands." - }, - "values": [{ - "id": "1", - "label": { - "en": "(1) Switch off only. (Default)" - } - }, { - "id": "2", - "label": { - "en": "(2) Switch on only." - } - }, { - "id": "255", - "label": { - "en": "(255) Switch all on and off" - } - }] - }, - { - "id": "invert_buttons", - "type": "checkbox", - "label": { - "en": "Invert buttons" - }, - "value": false, - "hint": { - "en": "Invert the behaviour of the buttons." - } + "id": "com.devolo", + "name": { + "en": "Devolo" + }, + "version": "1.0.2", + "compatibility": ">=1.0.2", + "description": { + "en": "Devolo z-wave devices for Homey", + "nl": "Devolo z-wave devices voor Homey" + }, + "category": [ + "appliances", + "lights", + "climate" + ], + "images": { + "large": "/assets/images/large.png", + "small": "/assets/images/small.png" + }, + "author": { + "name": "Bram Oosterhuis", + "email": "bram.oosterhuis.nl@gmail.com" + }, + "contributors": { + "developers": [{ + "name": "Bram Oosterhuis", + "email": "bram.oosterhuis.nl@gmail.com" + }, { + "name": "Michel de Ru", + "email": "michel@de-ru.net" + }] + }, + "flow": { + "triggers": [{ + "id": "mt2652_btn1_single", + "title": { + "en": "Button 1 single press", + "nl": "Een maal gedrukt op knop 1" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn1_double", + "title": { + "en": "Button 1 double press", + "nl": "Twee maal gedrukt op knop 1" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn2_single", + "title": { + "en": "Button 2 single press", + "nl": "Een maal gedrukt op knop 2" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn2_double", + "title": { + "en": "Button 2 double press", + "nl": "Twee maal gedrukt op knop 2" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn3_single", + "title": { + "en": "Button 3 single press", + "nl": "Een maal gedrukt op knop 3" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn3_double", + "title": { + "en": "Button 3 double press", + "nl": "Twee maal gedrukt op knop 3" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn4_single", + "title": { + "en": "Button 4 single press", + "nl": "Een maal gedrukt op knop 4" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }, { + "id": "mt2652_btn4_double", + "title": { + "en": "Button 4 double press", + "nl": "Twee maal gedrukt op knop 4" + }, + "args": [{ + "name": "device", + "type": "device", + "filter": "driver_id=MT2652" + }] + }] + }, + "drivers": [{ + "id": "MT2652", + "name": { + "en": "Devolo Scene Switch (Z-Wave Plus)" + }, + "zwave": { + "manufacturerId": 373, + "productTypeId": 256, + "productId": 257, + "learnmode": { + "image": "/drivers/MT2652/assets/learnmode.svg", + "instruction": { + "en": "Activate inclusion on the device by pressing any one of the four buttons for one second", + "nl": "Om pairing te activeren, druk langer een seconde op een van de knoppen van de schakelaar." + } + }, + "associationGroups": [ + 1, + 2, + 3, + 4, + 5 + ] + }, + "class": "light", + "capabilities": [ + "measure_battery" + ], + "images": { + "large": "/drivers/MT2652/assets/images/large.png", + "small": "/drivers/MT2652/assets/images/small.png" + }, + "settings": [{ + "id": "button_1_and_3_pair_mode", + "type": "dropdown", + "label": { + "en": "Button 1 and 3 pair mode" + }, + "value": "1", + "hint": { + "en": "The parameter determines the behaviour of buttons 1 and 3." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Seperately, In separate mode button 1 works with control group A, button 3 with control group C. Click is On, Hold is dimming Up, Double click is Off, Click-Hold is dimming Down. " + } + }, { + "id": "1", + "label": { + "en": "(1) Pair without double clicks, In pair button A/C are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B and D" + } + }, { + "id": "2", + "label": { + "en": "(2) Pair with double clicks. In pair button A/C are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B,double click with group D" + } + }] + }, { + "id": "button_2_and_4_pair_mode", + "type": "dropdown", + "label": { + "en": "Button 2 and 4 pair mode" + }, + "value": "1", + "hint": { + "en": "The parameter determines the behaviour of buttons 2 and 4." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Seperately, In separate mode button 2 works with control group B, button 4 with control group D. Click is On, Hold is dimming Up, Double click is Off, Click-Hold is dimming Down. " + } + }, { + "id": "1", + "label": { + "en": "(1) Pair without double clicks, In pair button B/D are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B and D" + } + }, { + "id": "2", + "label": { + "en": "(2) Pair with double clicks. In pair button B/D are Up/Down correspondingly. Click is On/Off, Hold is dimming Up/Down. Single clicks works with group B,double click with group D" + } + }] + }, { + "id": "command_to_control_group_a", + "type": "dropdown", + "label": { + "en": "Command to Control Group A" + }, + "value": "8", + "hint": { + "en": "This parameter defines the command to be sent to devices of control group A when the related button is pressed." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Disabled" + } + }, { + "id": "1", + "label": { + "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" + } + }, { + "id": "2", + "label": { + "en": "(3) Switch On/Off only (send Basic Set)" + } + }, { + "id": "3", + "label": { + "en": "(3) Switch All" + } + }, { + "id": "4", + "label": { + "en": "(4) Send Scenes" + } + }, { + "id": "5", + "label": { + "en": "(5) Send Preconfigured Scenes" + } + }, { + "id": "7", + "label": { + "en": "(7) Control DoorLock" + } + }, { + "id": "8", + "label": { + "en": "(8) Central Scene to Gateway (Default)" + } + }] + }, { + "id": "command_to_control_group_b", + "type": "dropdown", + "label": { + "en": "Command to Control Group B" + }, + "value": "8", + "hint": { + "en": "This parameter defines the command to be sent to devices of control group B when the related button is pressed." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Disabled" + } + }, { + "id": "1", + "label": { + "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" + } + }, { + "id": "2", + "label": { + "en": "(3) Switch On/Off only (send Basic Set)" + } + }, { + "id": "3", + "label": { + "en": "(3) Switch All" + } + }, { + "id": "4", + "label": { + "en": "(4) Send Scenes" + } + }, { + "id": "5", + "label": { + "en": "(5) Send Preconfigured Scenes" + } + }, { + "id": "7", + "label": { + "en": "(7) Control DoorLock" + } + }, { + "id": "8", + "label": { + "en": "(8) Central Scene to Gateway (Default)" + } + }] + }, { + "id": "command_to_control_group_c", + "type": "dropdown", + "label": { + "en": "Command to Control Group C" + }, + "value": "8", + "hint": { + "en": "This parameter defines the command to be sent to devices of control group C when the related button is pressed." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Disabled" + } + }, { + "id": "1", + "label": { + "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" + } + }, { + "id": "2", + "label": { + "en": "(3) Switch On/Off only (send Basic Set)" + } + }, { + "id": "3", + "label": { + "en": "(3) Switch All" + } + }, { + "id": "4", + "label": { + "en": "(4) Send Scenes" + } + }, { + "id": "5", + "label": { + "en": "(5) Send Preconfigured Scenes" + } + }, { + "id": "7", + "label": { + "en": "(7) Control DoorLock" + } + }, { + "id": "8", + "label": { + "en": "(8) Central Scene to Gateway (Default)" + } + }] + }, { + "id": "command_to_control_group_d", + "type": "dropdown", + "label": { + "en": "Command to Control Group D" + }, + "value": "8", + "hint": { + "en": "This parameter defines the command to be sent to devices of control group D when the related button is pressed." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Disabled" + } + }, { + "id": "1", + "label": { + "en": "(1) Switch On/Off and Dim (send Basic Set and Switch Multilevel)" + } + }, { + "id": "2", + "label": { + "en": "(3) Switch On/Off only (send Basic Set)" + } + }, { + "id": "3", + "label": { + "en": "(3) Switch All" + } + }, { + "id": "4", + "label": { + "en": "(4) Send Scenes" + } + }, { + "id": "5", + "label": { + "en": "(5) Send Preconfigured Scenes" + } + }, { + "id": "7", + "label": { + "en": "(7) Control DoorLock" + } + }, { + "id": "8", + "label": { + "en": "(8) Central Scene to Gateway (Default)" + } + }] + }, { + "id": "send_the_following_switch_sll_commands", + "type": "dropdown", + "label": { + "en": "Switch All commands" + }, + "value": "1", + "hint": { + "en": "Send the following Switch All commands." + }, + "values": [{ + "id": "1", + "label": { + "en": "(1) Switch off only. (Default)" + } + }, { + "id": "2", + "label": { + "en": "(2) Switch on only." + } + }, { + "id": "255", + "label": { + "en": "(255) Switch all on and off" + } + }] + }, { + "id": "invert_buttons", + "type": "checkbox", + "label": { + "en": "Invert buttons" + }, + "value": false, + "hint": { + "en": "Invert the behaviour of the buttons." + } - }, - { - "id": "blocks_wakeup_even_when_wakeup_interval_is_set", - "type": "dropdown", - "label": { - "en": "Blocks wakeup even when wakeup interval is set." - }, - "value": "1", - "hint": { - "en": "If the device wakes up and there is no controller nearby, several unsuccessful communication attempts will drain battery." - }, - "values": [{ - "id": "0", - "label": { - "en": "(0) Wakeup is blocked" - } - }, { - "id": "1", - "label": { - "en": "(1) Wakeup is possible if configured accordingly. (Default)" - } - }] - }, - { - "id": "send_unsolicited_battery_report_on_wake_up", - "type": "dropdown", - "label": { - "en": "Send unsolicited Battery Report on Wake Up " - }, - "value": "1", - "values": [{ - "id": "0", - "label": { - "en": "(0) No." - } - }, { - "id": "1", - "label": { - "en": "(1) To same node as wake up notification. (Default)" - } - }, { - "id": "2", - "label": { - "en": "(2) Broadcast to neighbours." - } - }] - }] - }, - { - "id": "014G0801", - "name": { - "en": "Devolo Home Control Radiator Thermostat", - "nl": "Devolo Home Control Radiatorthermostaat" - }, - "zwave": { - "manufacturerId": 373, - "productTypeId": 5, - "wakeUpInterval": 300, - "productId": 373, - "learnmode": { - "instruction": { - "en": "Press the middle button on your Devolo radiator thermostat.", - "nl": "Druk op de middelste knop van de Devolo radiatorthermostaat." - } - }, - "associationGroups": [ - 1 - ] - }, - "class": "thermostat", - "capabilities": [ - "target_temperature", - "measure_battery" - ], - "capabilitiesOptions": { - "target_temperature": { - "min": 4, - "max": 28 - } - }, - "images": { - "large": "/drivers/014G0801/assets/images/large.jpg", - "small": "/drivers/014G0801/assets/images/small.jpg" - } - } - ] -} + }, { + "id": "blocks_wakeup_even_when_wakeup_interval_is_set", + "type": "dropdown", + "label": { + "en": "Blocks wakeup even when wakeup interval is set." + }, + "value": "1", + "hint": { + "en": "If the device wakes up and there is no controller nearby, several unsuccessful communication attempts will drain battery." + }, + "values": [{ + "id": "0", + "label": { + "en": "(0) Wakeup is blocked" + } + }, { + "id": "1", + "label": { + "en": "(1) Wakeup is possible if configured accordingly. (Default)" + } + }] + }, { + "id": "send_unsolicited_battery_report_on_wake_up", + "type": "dropdown", + "label": { + "en": "Send unsolicited Battery Report on Wake Up " + }, + "value": "1", + "values": [{ + "id": "0", + "label": { + "en": "(0) No." + } + }, { + "id": "1", + "label": { + "en": "(1) To same node as wake up notification. (Default)" + } + }, { + "id": "2", + "label": { + "en": "(2) Broadcast to neighbours." + } + }] + }] + }, { + "id": "014G0801", + "name": { + "en": "Home Control Radiator Thermostat", + "nl": "Home Control Radiatorthermostaat" + }, + "zwave": { + "manufacturerId": 2, + "productTypeId": 5, + "productId": 373, + "wakeUpInterval": 300, + "learnmode": { + "image": "drivers/014G0801/assets/learnmode.svg", + "instruction": { + "en": "Press the middle button on your Devolo Home Control Radiator Thermostat", + "nl": "Druk op de middelste knop van de Devolo Home Control Radiatorthermostaat" + } + }, + "associationGroups": 1 + }, + "class": "thermostat", + "capabilities": [ + "target_temperature", + "measure_temperature", + "measure_battery" + ], + "capabilitiesOptions": { + "target_temperature": { + "min": 4, + "max": 28 + } + }, + "images": { + "small": "drivers/014G0801/assets/images/small.png", + "large": "drivers/014G0801/assets/images/large.png" + } + }] +} \ No newline at end of file diff --git a/drivers/014G0801/assets/learnmode.svg b/drivers/014G0801/assets/learnmode.svg new file mode 100644 index 0000000..ba2fb09 --- /dev/null +++ b/drivers/014G0801/assets/learnmode.svg @@ -0,0 +1,3 @@ + +Created by potrace 1.10, written by Peter Selinger 2001-2011 +Layer 1 \ No newline at end of file diff --git a/drivers/014G0801/driver.js b/drivers/014G0801/driver.js index 1648c64..b96adf7 100644 --- a/drivers/014G0801/driver.js +++ b/drivers/014G0801/driver.js @@ -3,64 +3,112 @@ const path = require('path'); const ZwaveDriver = require('homey-zwavedriver'); -// http://www.vesternet.com/downloads/dl/file/id/196/product/1128/z_wave_danfoss_lc_13_living_connect_radiator_thermostat_manual.pdf +// Get the driver object +var driver = findWhere(Homey.manifest.drivers, { id: path.basename(__dirname) }); +// Get the wakeUpInterval from the driver object (in order to set the pollInterval to the same value) +var wakeUpInterval = driver.zwave.wakeUpInterval * 1000; +Homey.log("Will set pollInterval to the same value as wakeUpInterval, which is: " + wakeUpInterval + " ms"); + +// http://www.vesternet.com/downloads/dl/file/id/196/z_wave_danfoss_lc_13_living_connect_radiator_thermostat_manual.pdf +// http://www.devolo.co.uk/fileadmin/user_upload/Products/devolo-Home-Control-Radiator-Control/Documents/PDF_en/Manual-devolo-Home-Control-Radiator-Thermostat-com.pdf +// http://products.z-wavealliance.org/products/1258/embedpics +// http://heating.danfoss.com/PCMPDF/Z_wave_commands_VDFNN202_teamcent.pdf +// http://www.benext.eu/static/manual/danfoss/livingconnect.pdf module.exports = new ZwaveDriver(path.basename(__dirname), { + debug: true, capabilities: { - measure_battery: { + measure_battery: { + // http://z-wave.sigmadesigns.com/wp-content/uploads/2016/08/SDS12657-12-Z-Wave-Command-Class-Specification-A-M.pdf, page 125 + // + // The Battery Level Get Command is used to request the level of a battery. + // The Battery Level Report Command MUST be returned in response to this command. + // + // The Battery Command Class is used to request and report battery levels for a given device. + // The battery level reports percentage of the full battery. + // The field can take values from 0 to 100% (0x00–0x64). + // The value 0xFF indicates a battery low warning. + // command_class: 'COMMAND_CLASS_BATTERY', command_get: 'BATTERY_GET', command_report: 'BATTERY_REPORT', command_report_parser: report => { - if (report['Battery Level'] === "battery low warning") return 1; - return report['Battery Level (Raw)'][0]; - } + var batt_level = report['Battery Level (Raw)'][0]; + // 0xFF is a special value to indicate the battery is low + return (batt_level == 0xFF) ? 1 : batt_level; + }, + pollInterval: wakeUpInterval + }, + + measure_temperature: { + // http://z-wave.sigmadesigns.com/wp-content/uploads/2016/08/SDS12657-12-Z-Wave-Command-Class-Specification-A-M.pdf, page 525 + // + command_class: 'COMMAND_CLASS_SENSOR_MULTILEVEL', + command_get: 'SENSOR_MULTILEVEL_GET', + command_get_parser: () => { + return { + 'Sensor Type': 'Temperature (version 1)', + 'Properties1': { + 'Scale': 0 + } + }; + }, + command_report: 'SENSOR_MULTILEVEL_REPORT', + command_report_parser: report => { + return Math.round (report['Sensor Value (Parsed)'] * 10) / 10; + }, + pollInterval: wakeUpInterval }, + target_temperature: { + // http://z-wave.sigmadesigns.com/wp-content/uploads/2016/08/SDS12652-13-Z-Wave-Command-Class-Specification-N-Z.pdf, page 321 + // command_class: 'COMMAND_CLASS_THERMOSTAT_SETPOINT', command_get: 'THERMOSTAT_SETPOINT_GET', - command_get_parser: function () { + command_get_parser: () => { return { 'Level': { 'Setpoint Type': 'Heating 1', } }; }, + command_report: 'THERMOSTAT_SETPOINT_REPORT', + command_report_parser: report => { + if (report.hasOwnProperty('Level2') && + report.Level2.hasOwnProperty('Precision') && + report.Level2.hasOwnProperty('Size')) { + const scale = Math.pow(10, report.Level2['Precision']); + return report['Value'].readUIntBE(0, report.Level2['Size']) / scale; + //console.log(report['Value'].readUIntBE(0, report.Level2['Size']) / scale); + } + }, command_set: 'THERMOSTAT_SETPOINT_SET', - command_set_parser: function (value) { + command_set_parser: value => { + // make temperature a whole number + let temp = Math.round(value*10); - // Create value buffer - let a = new Buffer(2); - a.writeUInt16BE(( Math.round(value * 2) / 2 * 10).toFixed(0)); + // create 2 byte buffer of the value + const tempByte1 = Math.floor(temp/255); + const tempByte2 = Math.round(temp-(255*tempByte1)); + temp = new Buffer([tempByte1, tempByte2]); return { - 'Level' : { - 'Setpoint Type': 'Heating 1' - }, - 'Level2': { - 'Size': 2, - 'Scale': 0, - 'Precision': 1 - }, - 'Value': a + 'Level': new Buffer([1]), // Reserved = 0 (bits: 000), Setpoint Type = 1 (Heating)(bits: 00001) + 'Level2': new Buffer([34]), // Precision = 1 (bits: 001), Scale = 0 (bits: 00), Size = 2 (bits: 010) + 'Value': temp }; }, - command_report: 'THERMOSTAT_SETPOINT_REPORT', - command_report_parser: report => { - if (report.hasOwnProperty('Level2') - && report.Level2.hasOwnProperty('Scale') - && report.Level2.hasOwnProperty('Precision') - && report.Level2['Scale'] === 0 - && report.Level2['Size'] !== 'undefined' - && typeof report['Value'].readUIntBE(0, report.Level2['Size']) !== 'undefined') { - - return report['Value'].readUIntBE(0, report.Level2['Size']) / Math.pow(10, report.Level2['Precision']); - } - return null; - }, - }, - }, - settings: { - + pollInterval: wakeUpInterval + } } -}); \ No newline at end of file +}); + +/** + * Plain js implementation of underscore's findWhere. + * @param array + * @param criteria + * @returns {*} + */ +function findWhere(array, criteria) { + return array.find(item => Object.keys(criteria).every(key => item[key] === criteria[key])); +} diff --git a/package.json b/package.json index c22d6a5..3aacbcd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "com.devolo", - "version": "1.0.0", + "version": "1.0.2", "description": "This app adds support for Devolo devices in Homey", "main": "app.js", "dependencies": {