From 711c2c6331544b9e40138a54d5da8251a3596c33 Mon Sep 17 00:00:00 2001 From: liangjia <“jia.liang@itead.cc”> Date: Wed, 6 Sep 2023 17:06:09 +0800 Subject: [PATCH 1/7] add sonoff new device SNZB-06P Zigbee occupancy sensor and TRVZB zigbee thermostat --- src/devices/sonoff.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index 209faf2052c38..b6817381ad00e 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -314,6 +314,39 @@ const definitions: Definition[] = [ await reporting.batteryPercentageRemaining(endpoint, {min: 3600, max: 7200}); }, }, + { + zigbeeModel: ['SNZB-06P'], + model: 'SNZB-06P', + vendor: 'SONOFF', + description: 'Zigbee occupancy sensor', + fromZigbee: [fz.occupancy], + toZigbee: [], + exposes: [e.occupancy()], + }, + { + zigbeeModel: ['TRVZB'], + model: 'TRVZB', + vendor: 'SONOFF', + description: 'Zigbee thermostat', + exposes: [ + exposes.climate() + .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) + .withLocalTemperature() + .withSystemMode(['off','auto','heat'], ea.ALL, 'Mode of the thermostat') + .withRunningState(['idle', 'heat'], ea.STATE)], + fromZigbee: [fz.thermostat], + toZigbee: [tz.thermostat_local_temperature,tz.thermostat_local_temperature_calibration,tz.thermostat_occupied_heating_setpoint,tz.thermostat_system_mode,tz.thermostat_running_state], + configure: async (device, coordinatorEndpoint, logger) => { + const endpoint = device.getEndpoint(1); + const binds = ['hvacThermostat']; + await reporting.bind(endpoint, coordinatorEndpoint, binds); + await reporting.thermostatTemperature(endpoint); + await reporting.thermostatOccupiedHeatingSetpoint(endpoint); + try { + await reporting.thermostatSystemMode(endpoint); + } catch (error) {/* Not all support this */} + }, + }, ]; module.exports = definitions; From efe83eac47f91a55c361e3c1ace3f80839a6a5af Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 6 Sep 2023 19:57:46 +0200 Subject: [PATCH 2/7] Update sonoff.ts --- src/devices/sonoff.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index b6817381ad00e..e6c19f0140573 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -315,7 +315,7 @@ const definitions: Definition[] = [ }, }, { - zigbeeModel: ['SNZB-06P'], + zigbeeModel: ['SNZB-06P'], model: 'SNZB-06P', vendor: 'SONOFF', description: 'Zigbee occupancy sensor', @@ -329,22 +329,21 @@ const definitions: Definition[] = [ vendor: 'SONOFF', description: 'Zigbee thermostat', exposes: [ - exposes.climate() + e.climate() .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) .withLocalTemperature() - .withSystemMode(['off','auto','heat'], ea.ALL, 'Mode of the thermostat') + .withSystemMode(['off', 'auto', 'heat'], ea.ALL, 'Mode of the thermostat') .withRunningState(['idle', 'heat'], ea.STATE)], fromZigbee: [fz.thermostat], - toZigbee: [tz.thermostat_local_temperature,tz.thermostat_local_temperature_calibration,tz.thermostat_occupied_heating_setpoint,tz.thermostat_system_mode,tz.thermostat_running_state], + toZigbee: [ + tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, + tz.thermostat_system_mode, tz.thermostat_running_state], configure: async (device, coordinatorEndpoint, logger) => { - const endpoint = device.getEndpoint(1); - const binds = ['hvacThermostat']; - await reporting.bind(endpoint, coordinatorEndpoint, binds); + const endpoint = device.getEndpoint(1); + await reporting.bind(endpoint, coordinatorEndpoint, ['hvacThermostat']); await reporting.thermostatTemperature(endpoint); await reporting.thermostatOccupiedHeatingSetpoint(endpoint); - try { - await reporting.thermostatSystemMode(endpoint); - } catch (error) {/* Not all support this */} + await reporting.thermostatSystemMode(endpoint); }, }, ]; From 59630bf6d89c52f37d997cee9c4eebe0497cc830 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 6 Sep 2023 19:59:24 +0200 Subject: [PATCH 3/7] Update sonoff.ts --- src/devices/sonoff.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index e6c19f0140573..38689ab473aa4 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -333,7 +333,7 @@ const definitions: Definition[] = [ .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) .withLocalTemperature() .withSystemMode(['off', 'auto', 'heat'], ea.ALL, 'Mode of the thermostat') - .withRunningState(['idle', 'heat'], ea.STATE)], + .withRunningState(['idle', 'heat'], ea.ALL)], fromZigbee: [fz.thermostat], toZigbee: [ tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, From 0810098e7fab1810ada91585d52fb125249097e6 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 6 Sep 2023 20:05:31 +0200 Subject: [PATCH 4/7] Update sonoff.ts --- src/devices/sonoff.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index 38689ab473aa4..ea9beef33e62b 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -333,7 +333,7 @@ const definitions: Definition[] = [ .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) .withLocalTemperature() .withSystemMode(['off', 'auto', 'heat'], ea.ALL, 'Mode of the thermostat') - .withRunningState(['idle', 'heat'], ea.ALL)], + .withRunningState(['idle', 'heat'], ea.STATE_GET)], fromZigbee: [fz.thermostat], toZigbee: [ tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, From 628bd63379fc21837d3c6e0f5b4d3aa9c9822333 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Wed, 6 Sep 2023 20:09:48 +0200 Subject: [PATCH 5/7] Update sonoff.ts --- src/devices/sonoff.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index ea9beef33e62b..2614b7cb2403d 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -336,7 +336,7 @@ const definitions: Definition[] = [ .withRunningState(['idle', 'heat'], ea.STATE_GET)], fromZigbee: [fz.thermostat], toZigbee: [ - tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, + tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, tz.thermostat_system_mode, tz.thermostat_running_state], configure: async (device, coordinatorEndpoint, logger) => { const endpoint = device.getEndpoint(1); From 59ad2737beef355293bfb55f2cbec3847df11ef6 Mon Sep 17 00:00:00 2001 From: liangjia <“jia.liang@itead.cc”> Date: Thu, 7 Sep 2023 19:10:05 +0800 Subject: [PATCH 6/7] add battery to TRVZB --- src/devices/sonoff.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index 2614b7cb2403d..d1f5ffa94941f 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -333,8 +333,8 @@ const definitions: Definition[] = [ .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) .withLocalTemperature() .withSystemMode(['off', 'auto', 'heat'], ea.ALL, 'Mode of the thermostat') - .withRunningState(['idle', 'heat'], ea.STATE_GET)], - fromZigbee: [fz.thermostat], + .withRunningState(['idle', 'heat'], ea.STATE_GET),e.battery_low(),e.battery_low()], + fromZigbee: [fz.thermostat,fromZigbee_1.default.battery], toZigbee: [ tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, tz.thermostat_system_mode, tz.thermostat_running_state], From 8f84f64eb2a96ad1ca5d3b04be826bed9b0d7f6f Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Thu, 7 Sep 2023 20:40:25 +0200 Subject: [PATCH 7/7] Update sonoff.ts --- src/devices/sonoff.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/devices/sonoff.ts b/src/devices/sonoff.ts index d1f5ffa94941f..f0e91ec9eacb1 100644 --- a/src/devices/sonoff.ts +++ b/src/devices/sonoff.ts @@ -333,8 +333,8 @@ const definitions: Definition[] = [ .withSetpoint('occupied_heating_setpoint', 4, 35, 0.5) .withLocalTemperature() .withSystemMode(['off', 'auto', 'heat'], ea.ALL, 'Mode of the thermostat') - .withRunningState(['idle', 'heat'], ea.STATE_GET),e.battery_low(),e.battery_low()], - fromZigbee: [fz.thermostat,fromZigbee_1.default.battery], + .withRunningState(['idle', 'heat'], ea.STATE_GET), e.battery(), e.battery_low()], + fromZigbee: [fz.thermostat, fz.battery], toZigbee: [ tz.thermostat_local_temperature, tz.thermostat_local_temperature_calibration, tz.thermostat_occupied_heating_setpoint, tz.thermostat_system_mode, tz.thermostat_running_state],