@@ -39,6 +39,66 @@ describe("Bosch thermostats", () => {
3939 expect ( definition . toZigbee . some ( ( converter ) => converter . key . includes ( "weekly_schedule" ) ) ) . toBe ( false ) ;
4040 expect ( JSON . stringify ( definition . exposes ) ) . not . toContain ( "weekly_schedule" ) ;
4141 } ) ;
42+
43+ it ( "does not publish cable sensor temperature when cable sensor mode is disabled" , ( ) => {
44+ const device = mockDevice ( {
45+ modelID : "RBSH-RTH0-ZB-EU" ,
46+ manufacturerName : "BOSCH" ,
47+ endpoints : [
48+ {
49+ ID : 1 ,
50+ inputClusters : [ "hvacThermostat" ] ,
51+ } ,
52+ ] ,
53+ } ) ;
54+ const extend = boschThermostatExtend . cableSensorTemperature ( ) ;
55+ const converter = extend . fromZigbee ?. [ 0 ] ;
56+
57+ if ( ! converter ?. convert ) throw new Error ( "No fromZigbee converter for cable_sensor_temperature" ) ;
58+
59+ const result = converter . convert (
60+ device ,
61+ {
62+ data : { cableSensorTemperature : 2150 } ,
63+ endpoint : device . getEndpoint ( 1 ) ,
64+ } as never ,
65+ ( ) => { } ,
66+ { } ,
67+ { state : { cable_sensor_mode : "not_used" } } as never ,
68+ ) ;
69+
70+ expect ( result ) . toBeUndefined ( ) ;
71+ } ) ;
72+
73+ it ( "publishes cable sensor temperature when cable sensor mode is enabled" , ( ) => {
74+ const device = mockDevice ( {
75+ modelID : "RBSH-RTH0-ZB-EU" ,
76+ manufacturerName : "BOSCH" ,
77+ endpoints : [
78+ {
79+ ID : 1 ,
80+ inputClusters : [ "hvacThermostat" ] ,
81+ } ,
82+ ] ,
83+ } ) ;
84+ const extend = boschThermostatExtend . cableSensorTemperature ( ) ;
85+ const converter = extend . fromZigbee ?. [ 0 ] ;
86+
87+ if ( ! converter ?. convert ) throw new Error ( "No fromZigbee converter for cable_sensor_temperature" ) ;
88+
89+ const result = converter . convert (
90+ device ,
91+ {
92+ data : { cableSensorTemperature : 2150 } ,
93+ endpoint : device . getEndpoint ( 1 ) ,
94+ } as never ,
95+ ( ) => { } ,
96+ { } ,
97+ { state : { cable_sensor_mode : "cable_sensor_without_regulation" } } as never ,
98+ ) ;
99+
100+ expect ( result ) . toStrictEqual ( { cable_sensor_temperature : 21.5 } ) ;
101+ } ) ;
42102} ) ;
43103
44104describe ( "Bosch thermostat relayState extension" , ( ) => {
0 commit comments