@@ -1008,13 +1008,15 @@ describe("Extension: HomeAssistant", () => {
10081008 property : "network" ,
10091009 label : "Network" ,
10101010 access : 3 ,
1011+ category : "config" ,
10111012 features : [
10121013 {
10131014 type : "numeric" ,
10141015 name : "timeout" ,
10151016 property : "timeout" ,
10161017 label : "Timeout" ,
10171018 access : 3 ,
1019+ category : "config" ,
10181020 unit : "min" ,
10191021 value_min : 1 ,
10201022 value_max : 60 ,
@@ -1026,6 +1028,7 @@ describe("Extension: HomeAssistant", () => {
10261028 property : "temperature" ,
10271029 label : "Temperature" ,
10281030 access : 1 ,
1031+ category : "diagnostic" ,
10291032 unit : "°C" ,
10301033 } ,
10311034 {
@@ -1091,24 +1094,28 @@ describe("Extension: HomeAssistant", () => {
10911094 value_template :
10921095 '{% if value_json["network"] is defined and value_json["network"]["timeout"] is defined %}{{ value_json["network"]["timeout"] }}{% endif %}' ,
10931096 command_template : '{"network": {"timeout": {{ value }}}}' ,
1097+ entity_category : "config" ,
10941098 unit_of_measurement : "min" ,
10951099 min : 1 ,
10961100 max : 60 ,
10971101 step : 1 ,
10981102 } ) ;
10991103 expect ( configs . find ( ( config ) => config . object_id === "network_temperature" ) ?. discovery_payload ) . toMatchObject ( {
1104+ entity_category : "diagnostic" ,
11001105 unit_of_measurement : "°C" ,
11011106 device_class : "temperature" ,
11021107 state_class : "measurement" ,
11031108 } ) ;
11041109 expect ( configs . find ( ( config ) => config . object_id === "network_mode" ) ?. discovery_payload ) . toMatchObject ( {
11051110 command_template : '{"network": {"mode": {{ value | tojson }}}}' ,
1111+ entity_category : "config" ,
11061112 options : [ "auto" , "manual" ] ,
11071113 } ) ;
11081114 expect ( configs . find ( ( config ) => config . object_id === "network_advanced_enabled" ) ?. discovery_payload ) . toMatchObject ( {
11091115 value_template :
11101116 '{% if value_json["network"] is defined and value_json["network"]["advanced"] is defined and value_json["network"]["advanced"]["enabled"] is defined %}{{ value_json["network"]["advanced"]["enabled"] | string | lower }}{% endif %}' ,
11111117 command_template : '{"network": {"advanced": {"enabled": {{ value }}}}}' ,
1118+ entity_category : "config" ,
11121119 payload_on : "true" ,
11131120 payload_off : "false" ,
11141121 } ) ;
@@ -1375,6 +1382,18 @@ describe("Extension: HomeAssistant", () => {
13751382 overrideSpy . mockRestore ( ) ;
13761383 } ) ;
13771384
1385+ it ( "passes device options to discovery payload overrides" , async ( ) => {
1386+ const bosch = getZ2MEntity ( devices . BTH_RM230Z ) as Device ;
1387+ assert ( typeof bosch . definition ?. meta ?. overrideHaDiscoveryPayload === "function" ) ;
1388+ const overrideSpy = vi . spyOn ( bosch . definition . meta , "overrideHaDiscoveryPayload" ) as MockInstance ;
1389+ settings . set ( [ "devices" , "0x18fc2600000d7ae3" , "expose_cooling" ] , true ) ;
1390+
1391+ await resetExtension ( ) ;
1392+
1393+ expect ( overrideSpy ) . toHaveBeenCalledWith ( expect . any ( Object ) , expect . objectContaining ( { expose_cooling : true } ) ) ;
1394+ overrideSpy . mockRestore ( ) ;
1395+ } ) ;
1396+
13781397 it ( "Should discover Bosch BTH-RM230Z with a current_humidity attribute" , ( ) => {
13791398 const payload = {
13801399 action_template :
0 commit comments