@@ -95,53 +95,53 @@ describe("Extension: HomeAssistant", () => {
9595
9696 it ( "Should discover weekly_schedule sensor with json_attributes instead of truncated value" , ( ) => {
9797 // Create a SONOFF TRVZB expose definition with schedule (composite type)
98- const trvzbExposes = [
99- {
100- type : "climate" ,
101- features : [
102- {
103- name : "occupied_heating_setpoint" ,
104- property : "occupied_heating_setpoint" ,
105- type : "numeric" ,
106- access : 7 ,
107- value_min : 4 ,
108- value_max : 35 ,
109- value_step : 0.5 ,
110- } ,
111- { name : "local_temperature" , property : "local_temperature" , type : "numeric" , access : 5 } ,
112- { name : "system_mode" , property : "system_mode" , type : "enum" , access : 7 , values : [ "off" , "auto" , "heat" ] } ,
113- { name : "running_state" , property : "running_state" , type : "enum" , access : 5 , values : [ "idle" , "heat" ] } ,
114- ] ,
115- } ,
98+ const trvzbExposes = [
99+ {
100+ type : "climate" ,
101+ features : [
116102 {
117- type : "composite" ,
118- name : "schedule" ,
119- property : "weekly_schedule" ,
120- label : "Schedule" ,
121- access : 3 ,
122- category : "config" ,
123- features : [
124- { name : "sunday" , property : "sunday" , type : "text" , access : 3 } ,
125- { name : "monday" , property : "monday" , type : "text" , access : 3 } ,
126- { name : "tuesday" , property : "tuesday" , type : "text" , access : 3 } ,
127- { name : "wednesday" , property : "wednesday" , type : "text" , access : 3 } ,
128- { name : "thursday" , property : "thursday" , type : "text" , access : 3 } ,
129- { name : "friday" , property : "friday" , type : "text" , access : 3 } ,
130- { name : "saturday" , property : "saturday" , type : "text" , access : 3 } ,
131- ] ,
103+ name : "occupied_heating_setpoint" ,
104+ property : "occupied_heating_setpoint" ,
105+ type : "numeric" ,
106+ access : 7 ,
107+ value_min : 4 ,
108+ value_max : 35 ,
109+ value_step : 0.5 ,
132110 } ,
133- ] ;
134-
135- // Create a mock device with TRVZB exposes
136- const mockDevice = {
137- definition : { vendor : "SONOFF" , model : "TRVZB" } ,
138- isDevice : ( ) => true ,
139- isGroup : ( ) => false ,
140- options : { ID : "0x1234567890abcdef" } ,
141- exposes : ( ) => trvzbExposes ,
142- zh : { endpoints : [ ] } ,
143- name : "test_trvzb" ,
144- } ;
111+ { name : "local_temperature" , property : "local_temperature" , type : "numeric" , access : 5 } ,
112+ { name : "system_mode" , property : "system_mode" , type : "enum" , access : 7 , values : [ "off" , "auto" , "heat" ] } ,
113+ { name : "running_state" , property : "running_state" , type : "enum" , access : 5 , values : [ "idle" , "heat" ] } ,
114+ ] ,
115+ } ,
116+ {
117+ type : "composite" ,
118+ name : "schedule" ,
119+ property : "weekly_schedule" ,
120+ label : "Schedule" ,
121+ access : 3 ,
122+ category : "config" ,
123+ features : [
124+ { name : "sunday" , property : "sunday" , type : "text" , access : 3 } ,
125+ { name : "monday" , property : "monday" , type : "text" , access : 3 } ,
126+ { name : "tuesday" , property : "tuesday" , type : "text" , access : 3 } ,
127+ { name : "wednesday" , property : "wednesday" , type : "text" , access : 3 } ,
128+ { name : "thursday" , property : "thursday" , type : "text" , access : 3 } ,
129+ { name : "friday" , property : "friday" , type : "text" , access : 3 } ,
130+ { name : "saturday" , property : "saturday" , type : "text" , access : 3 } ,
131+ ] ,
132+ } ,
133+ ] ;
134+
135+ // Create a mock device with TRVZB exposes
136+ const mockDevice = {
137+ definition : { vendor : "SONOFF" , model : "TRVZB" } ,
138+ isDevice : ( ) => true ,
139+ isGroup : ( ) => false ,
140+ options : { ID : "0x1234567890abcdef" } ,
141+ exposes : ( ) => trvzbExposes ,
142+ zh : { endpoints : [ ] } ,
143+ name : "test_trvzb" ,
144+ } ;
145145
146146 // @ts -expect-error private
147147 const configs = extension . getConfigs ( mockDevice ) ;
0 commit comments