Permalink
Browse files

Update zigbee2mqtt.class.php

  • Loading branch information...
directman66 committed Jan 21, 2019
1 parent 5f7973a commit aecd635b789fca15f246e40ed81c76e8d0e3b6d0
Showing with 55 additions and 52 deletions.
  1. +55 −52 modules/zigbee2mqtt/zigbee2mqtt.class.php
@@ -3220,7 +3220,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.click }}";
$par2['value_template'] = "click";
$par2['json_attributes'] = "linkquality;battery;voltage;action;duration";
$par2['device_class'] = "";
$par2['type'] = "";
@@ -3233,7 +3233,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.click }}";
$par2['value_template'] = "click";
$par2['json_attributes'] = "linkquality;battery;voltage;action;duration";
$par2['device_class'] = "";
$par2['type'] = "";
@@ -3246,7 +3246,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.click }}";
$par2['value_template'] = "click";
$par2['json_attributes'] = "linkquality;battery;voltage;action;duration";
$par2['device_class'] = "";
$par2['type'] = "";
@@ -3260,7 +3260,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.click }}";
$par2['value_template'] = "click";
$par2['json_attributes'] = "linkquality;battery;voltage;action;duration";
$par2['device_class'] = "";
$par2['type'] = "";
@@ -3273,33 +3273,22 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.click }}";
$par2['value_template'] = "click";
$par2['json_attributes'] = "linkquality;battery;voltage;action;duration";
$par2['device_class'] = "";
$par2['type'] = "";
$par2['unit_of_measurement'] = "";
SQLInsert('zigbee2mqtt_devices_command', $par2);
$par2['zigbeeModel'] = 'QBKG04LM';
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state }}";
$par2['json_attributes'] = "";
$par2['device_class'] = "";
$par2['type'] = "";
$par2['unit_of_measurement'] = "";
SQLInsert('zigbee2mqtt_devices_command', $par2);
$par2['zigbeeModel'] = 'QBKG11LM';
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state }}";
$par2['value_template'] = "state";
$par2['json_attributes'] = "";
$par2['device_class'] = "";
$par2['type'] = "switch";
@@ -3312,20 +3301,21 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.power }}";
$par2['value_template'] = "power";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['device_class'] = "";
$par2['type'] = "sensor";
$par2['unit_of_measurement'] = "Watt";
SQLInsert('zigbee2mqtt_devices_command', $par2);
//
$par2['zigbeeModel'] = 'QBKG03LM';
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/left/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state_left }}";
$par2['value_template'] = "state_left";
$par2['json_attributes'] = "linkquality;button_left";
$par2['device_class'] = "";
$par2['type'] = "switch";
@@ -3338,7 +3328,7 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/right/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state_right }}";
$par2['value_template'] = "state_right";
$par2['json_attributes'] = "linkquality;button_left";
$par2['device_class'] = "";
$par2['type'] = "switch";
@@ -3352,7 +3342,7 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/left/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state_left }}";
$par2['value_template'] = "state_left";
$par2['json_attributes'] = "linkquality;button_left";
$par2['device_class'] = "";
$par2['type'] = "switch";
@@ -3366,8 +3356,8 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/right/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state_right }}";
$par2['json_attributes'] = "linkquality;button_left";
$par2['value_template'] = "state_right";
$par2['json_attributes'] = "linkquality;button_right";
$par2['device_class'] = "";
$par2['type'] = "switch";
$par2['unit_of_measurement'] = "";
@@ -3379,7 +3369,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.power }}";
$par2['value_template'] = "power";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['device_class'] = "";
$par2['type'] = "sensor";
@@ -3394,7 +3384,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.humidity }}";
$par2['value_template'] = "humidity";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['type'] = "sensor";
$par2['device_class'] = "humidity";
@@ -3408,7 +3398,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.temperature }}";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "llinkquality;battery;voltage";
$par2['type'] = "sensor";
$par2['device_class'] = "temperature";
@@ -3423,7 +3413,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.humidity }}";
$par2['value_template'] = "humidity";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['type'] = "sensor";
$par2['device_class'] = "humidity";
@@ -3437,7 +3427,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.temperature }}";
$par2['value_template'] = "temperature";
$par2['json_attributes'] = "linkquality;battery;voltage";
$par2['type'] = "sensor";
$par2['device_class'] = "temperature";
@@ -3451,7 +3441,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.pressure }}";
$par2['value_template'] = "pressure";
$par2['json_attributes'] = "linkquality;battery;voltage";
$par2['type'] = "sensor";
$par2['device_class'] = "pressure";
@@ -3466,7 +3456,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.occupancy }}";
$par2['value_template'] = "occupancy";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "motion";
@@ -3480,7 +3470,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3495,7 +3485,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.occupancy }}";
$par2['value_template'] = "occupancy";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "motion";
@@ -3509,7 +3499,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.illuminance }}";
$par2['value_template'] = "illuminance";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "illuminance";
@@ -3523,7 +3513,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3537,7 +3527,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.contact }}";
$par2['value_template'] = "contact";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "door";
@@ -3551,7 +3541,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3565,7 +3555,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.contact }}";
$par2['value_template'] = "contact";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "door";
@@ -3579,7 +3569,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3593,7 +3583,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.water_leak }}";
$par2['value_template'] = "water_leak";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "moisture";
@@ -3607,7 +3597,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3621,7 +3611,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.action }}";
$par2['value_template'] = "action";
$par2['json_attributes'] = "linkquality;battery;voltage;angle;side;from_side;to_side;brightness;angle_x_absolute;angle_y_absolute;angle_z;angle_y;angle_x;unknown_data";
$par2['type'] = "sensor";
$par2['device_class'] = "action";
@@ -3635,7 +3625,7 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state }}";
$par2['value_template'] = "state";
$par2['json_attributes'] = "";
$par2['type'] = "switch";
$par2['device_class'] = "state";
@@ -3649,7 +3639,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.power }}";
$par2['value_template'] = "power";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['type'] = "sensor";
$par2['device_class'] = "power";
@@ -3663,7 +3653,7 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "{{ value_json.state }}";
$par2['value_template'] = "state";
$par2['json_attributes'] = "";
$par2['type'] = "switch";
$par2['device_class'] = "state";
@@ -3677,7 +3667,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.power }}";
$par2['value_template'] = "power";
$par2['json_attributes'] = "linkquality;voltage;temperature;consumption;current;power_factor";
$par2['type'] = "sensor";
$par2['device_class'] = "power";
@@ -3691,7 +3681,7 @@ function dbInstall($data) {
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.smoke }}";
$par2['value_template'] = "smoke";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "smoke";
@@ -3705,10 +3695,10 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery ";
$par2['device_class'] = "battery";
$par2['unit_of_measurement'] = "";
SQLInsert('zigbee2mqtt_devices_command', $par2);
@@ -3720,7 +3710,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "true";
$par2['payload_off'] = "false";
$par2['value_template'] = "{{ value_json.occupancy }}";
$par2['value_template'] = "occupancy";
$par2['json_attributes'] = "";
$par2['type'] = "binary_sensor";
$par2['device_class'] = "motion";
@@ -3734,7 +3724,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.illuminance }}";
$par2['value_template'] = "illuminance";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "illuminance";
@@ -3748,7 +3738,7 @@ function dbInstall($data) {
$par2['command_topic'] = "";
$par2['payload_on'] = "";
$par2['payload_off'] = "";
$par2['value_template'] = "{{ value_json.battery }}";
$par2['value_template'] = "battery";
$par2['json_attributes'] = "linkquality;voltage;action;sensitivity";
$par2['type'] = "sensor";
$par2['device_class'] = "battery";
@@ -3757,6 +3747,19 @@ function dbInstall($data) {
//
$par2['zigbeeModel'] = 'QBKG04LM';
$par2['state_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>";
$par2['availability_topic'] = "zigbee2mqtt/bridge/state";
$par2['command_topic'] = "zigbee2mqtt/<FRIENDLY_NAME>/set";
$par2['payload_on'] = "ON";
$par2['payload_off'] = "OFF";
$par2['value_template'] = "state";
$par2['json_attributes'] = "";
$par2['device_class'] = "";
$par2['type'] = "switch";
$par2['unit_of_measurement'] = "";
SQLInsert('zigbee2mqtt_devices_command', $par2);

0 comments on commit aecd635

Please sign in to comment.