diff --git a/tests/data/devices/adurosmart-eria-ad-rgbw3001.json b/tests/data/devices/adurosmart-eria-ad-rgbw3001.json index 4b94de6f0..d0e54113c 100644 --- a/tests/data/devices/adurosmart-eria-ad-rgbw3001.json +++ b/tests/data/devices/adurosmart-eria-ad-rgbw3001.json @@ -390,6 +390,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -411,8 +412,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/aqara-lumi-light-agl003.json b/tests/data/devices/aqara-lumi-light-agl003.json index d4277f044..589ed98f9 100644 --- a/tests/data/devices/aqara-lumi-light-agl003.json +++ b/tests/data/devices/aqara-lumi-light-agl003.json @@ -694,6 +694,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 1, "xy_color": [ @@ -714,8 +715,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/aqara-lumi-light-agl005.json b/tests/data/devices/aqara-lumi-light-agl005.json index 9ce9273de..8a7262f22 100644 --- a/tests/data/devices/aqara-lumi-light-agl005.json +++ b/tests/data/devices/aqara-lumi-light-agl005.json @@ -700,6 +700,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -720,8 +721,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/awox-esmlfzm-w6-dimm.json b/tests/data/devices/awox-esmlfzm-w6-dimm.json index 903ddc171..10ec7395f 100644 --- a/tests/data/devices/awox-esmlfzm-w6-dimm.json +++ b/tests/data/devices/awox-esmlfzm-w6-dimm.json @@ -455,6 +455,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -474,8 +475,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/bosch-rbsh-mms-zb-eu.json b/tests/data/devices/bosch-rbsh-mms-zb-eu.json index 0262e7a05..f2aa4c988 100644 --- a/tests/data/devices/bosch-rbsh-mms-zb-eu.json +++ b/tests/data/devices/bosch-rbsh-mms-zb-eu.json @@ -724,6 +724,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -738,8 +739,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -790,6 +790,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -804,8 +805,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/candeo-c-zb-lc20-dim.json b/tests/data/devices/candeo-c-zb-lc20-dim.json index cd099e5b8..e209bb7aa 100644 --- a/tests/data/devices/candeo-c-zb-lc20-dim.json +++ b/tests/data/devices/candeo-c-zb-lc20-dim.json @@ -271,6 +271,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": null, @@ -286,8 +287,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/candeo-c-zb-lc20-rgb.json b/tests/data/devices/candeo-c-zb-lc20-rgb.json index 5c67ab8c5..98ab641b5 100644 --- a/tests/data/devices/candeo-c-zb-lc20-rgb.json +++ b/tests/data/devices/candeo-c-zb-lc20-rgb.json @@ -339,6 +339,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 2, "xy_color": [ @@ -358,8 +359,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json b/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json index 24d2944e9..1b4066999 100644 --- a/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json +++ b/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json @@ -399,6 +399,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -414,8 +415,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -480,6 +480,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -495,8 +496,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ericsity-gl-c-008p.json b/tests/data/devices/ericsity-gl-c-008p.json index dd3dadcc5..14ef994ab 100755 --- a/tests/data/devices/ericsity-gl-c-008p.json +++ b/tests/data/devices/ericsity-gl-c-008p.json @@ -369,6 +369,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -390,8 +391,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ericsity-gl-c-009p.json b/tests/data/devices/ericsity-gl-c-009p.json index b1b4973f3..f51b5e479 100644 --- a/tests/data/devices/ericsity-gl-c-009p.json +++ b/tests/data/devices/ericsity-gl-c-009p.json @@ -404,6 +404,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -420,8 +421,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ewelink-ck-bl702-al-01-7009-z102lg03-1.json b/tests/data/devices/ewelink-ck-bl702-al-01-7009-z102lg03-1.json index 623ee1449..93eb85a92 100644 --- a/tests/data/devices/ewelink-ck-bl702-al-01-7009-z102lg03-1.json +++ b/tests/data/devices/ewelink-ck-bl702-al-01-7009-z102lg03-1.json @@ -384,6 +384,7 @@ }, "state": { "class_name": "ForceOnLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -405,8 +406,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ewelink-zb-sw02.json b/tests/data/devices/ewelink-zb-sw02.json index 242ae9af4..5bfc2ace3 100644 --- a/tests/data/devices/ewelink-zb-sw02.json +++ b/tests/data/devices/ewelink-zb-sw02.json @@ -250,6 +250,7 @@ }, "state": { "class_name": "ForceOnLight", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -264,8 +265,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -316,6 +316,7 @@ }, "state": { "class_name": "ForceOnLight", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -330,8 +331,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/feibit-inc-co-fzb56-zcw27lx1-0.json b/tests/data/devices/feibit-inc-co-fzb56-zcw27lx1-0.json index 1d695ef2e..14a4ddc23 100644 --- a/tests/data/devices/feibit-inc-co-fzb56-zcw27lx1-0.json +++ b/tests/data/devices/feibit-inc-co-fzb56-zcw27lx1-0.json @@ -378,6 +378,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 76, "xy_color": [ @@ -399,8 +400,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/gledopto-gl-b-008p.json b/tests/data/devices/gledopto-gl-b-008p.json index 2659efb22..f83292844 100644 --- a/tests/data/devices/gledopto-gl-b-008p.json +++ b/tests/data/devices/gledopto-gl-b-008p.json @@ -414,6 +414,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -435,8 +436,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/homr-hrmsn01.json b/tests/data/devices/homr-hrmsn01.json index 83941b7b5..2facee6a6 100644 --- a/tests/data/devices/homr-hrmsn01.json +++ b/tests/data/devices/homr-hrmsn01.json @@ -513,6 +513,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 255, "xy_color": [ @@ -533,8 +534,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-ormanas-led-strip.json b/tests/data/devices/ikea-of-sweden-ormanas-led-strip.json index 7f333d4ee..2f80f989b 100644 --- a/tests/data/devices/ikea-of-sweden-ormanas-led-strip.json +++ b/tests/data/devices/ikea-of-sweden-ormanas-led-strip.json @@ -504,6 +504,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 56, "xy_color": [ @@ -525,8 +526,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-w-op-ch-400lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-w-op-ch-400lm.json index 296f530a8..533ca0c80 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-w-op-ch-400lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-w-op-ch-400lm.json @@ -321,6 +321,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 3, "xy_color": null, @@ -336,8 +337,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-ws-opal-400lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-ws-opal-400lm.json index 1f27706cb..333272ec0 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-ws-opal-400lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e12-ws-opal-400lm.json @@ -429,6 +429,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -445,8 +446,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e14-ws-globe-470lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e14-ws-globe-470lm.json index 276b2d127..220951cac 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e14-ws-globe-470lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e14-ws-globe-470lm.json @@ -376,6 +376,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": null, @@ -392,8 +393,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-opal-1000lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-opal-1000lm.json index 256922160..27f150d01 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-opal-1000lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-opal-1000lm.json @@ -311,6 +311,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": null, @@ -326,8 +327,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-w-opal-1000lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-w-opal-1000lm.json index 5bd737f19..01e68797f 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-w-opal-1000lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-w-opal-1000lm.json @@ -315,6 +315,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": null, @@ -330,8 +331,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-ws-opal-980lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-ws-opal-980lm.json index 8f396553d..bb5e930bf 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-ws-opal-980lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e26-ws-opal-980lm.json @@ -410,6 +410,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 3, "xy_color": null, @@ -426,8 +427,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e27-ww-g95-cl-470lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e27-ww-g95-cl-470lm.json index 737b3257a..2a9bd72b7 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-e27-ww-g95-cl-470lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-e27-ww-g95-cl-470lm.json @@ -295,6 +295,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": null, @@ -310,8 +311,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ikea-of-sweden-tradfri-bulb-gu10-ws-400lm.json b/tests/data/devices/ikea-of-sweden-tradfri-bulb-gu10-ws-400lm.json index 291230f1c..cf967d5ba 100644 --- a/tests/data/devices/ikea-of-sweden-tradfri-bulb-gu10-ws-400lm.json +++ b/tests/data/devices/ikea-of-sweden-tradfri-bulb-gu10-ws-400lm.json @@ -434,6 +434,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 1, "xy_color": null, @@ -450,8 +451,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/innr-ae-280-c.json b/tests/data/devices/innr-ae-280-c.json index ae48b39de..c55c6de08 100644 --- a/tests/data/devices/innr-ae-280-c.json +++ b/tests/data/devices/innr-ae-280-c.json @@ -370,6 +370,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -391,8 +392,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/innr-rb-285-c.json b/tests/data/devices/innr-rb-285-c.json index f8455e313..916066c04 100644 --- a/tests/data/devices/innr-rb-285-c.json +++ b/tests/data/devices/innr-rb-285-c.json @@ -396,6 +396,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -417,8 +418,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/inovelli-vzm30-sn.json b/tests/data/devices/inovelli-vzm30-sn.json index 596bbd62f..516dfdd5a 100644 --- a/tests/data/devices/inovelli-vzm30-sn.json +++ b/tests/data/devices/inovelli-vzm30-sn.json @@ -779,6 +779,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -794,8 +795,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/inovelli-vzm31-sn.json b/tests/data/devices/inovelli-vzm31-sn.json index 27aa9736f..ae0d7c46d 100644 --- a/tests/data/devices/inovelli-vzm31-sn.json +++ b/tests/data/devices/inovelli-vzm31-sn.json @@ -936,6 +936,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -951,8 +952,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/inovelli-vzm35-sn.json b/tests/data/devices/inovelli-vzm35-sn.json index 841c50cf4..480dc1b7c 100644 --- a/tests/data/devices/inovelli-vzm35-sn.json +++ b/tests/data/devices/inovelli-vzm35-sn.json @@ -591,6 +591,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -606,8 +607,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/isilentllc-masterbed-light-controller.json b/tests/data/devices/isilentllc-masterbed-light-controller.json index 7ce6f0727..477b25ba9 100644 --- a/tests/data/devices/isilentllc-masterbed-light-controller.json +++ b/tests/data/devices/isilentllc-masterbed-light-controller.json @@ -609,6 +609,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -628,8 +629,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/isilentllc-safe.json b/tests/data/devices/isilentllc-safe.json index 6c9f4ac40..8720d2409 100644 --- a/tests/data/devices/isilentllc-safe.json +++ b/tests/data/devices/isilentllc-safe.json @@ -450,6 +450,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -469,8 +470,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/jasco-products-45856.json b/tests/data/devices/jasco-products-45856.json index aac9b3a27..19613b3cc 100644 --- a/tests/data/devices/jasco-products-45856.json +++ b/tests/data/devices/jasco-products-45856.json @@ -364,6 +364,7 @@ }, "state": { "class_name": "ForceOnLight", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -378,8 +379,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/jasco-products-45857.json b/tests/data/devices/jasco-products-45857.json index 9d6104c07..f04522fb1 100644 --- a/tests/data/devices/jasco-products-45857.json +++ b/tests/data/devices/jasco-products-45857.json @@ -431,6 +431,7 @@ }, "state": { "class_name": "ForceOnLight", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -446,8 +447,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/king-of-fans-inc-hbuniversalcfremote.json b/tests/data/devices/king-of-fans-inc-hbuniversalcfremote.json index ae6f19405..c2ab4b8b0 100644 --- a/tests/data/devices/king-of-fans-inc-hbuniversalcfremote.json +++ b/tests/data/devices/king-of-fans-inc-hbuniversalcfremote.json @@ -369,6 +369,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -384,8 +385,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/king-of-fans-inc-hdc52eastwindfan.json b/tests/data/devices/king-of-fans-inc-hdc52eastwindfan.json index 612fd2ad9..f7cf717b6 100644 --- a/tests/data/devices/king-of-fans-inc-hdc52eastwindfan.json +++ b/tests/data/devices/king-of-fans-inc-hdc52eastwindfan.json @@ -375,6 +375,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -390,8 +391,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ledvance-flex-rgbw.json b/tests/data/devices/ledvance-flex-rgbw.json index 5b176d135..374d24009 100755 --- a/tests/data/devices/ledvance-flex-rgbw.json +++ b/tests/data/devices/ledvance-flex-rgbw.json @@ -431,6 +431,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -451,8 +452,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/ledvance-outdoor-accent-light-rgb.json b/tests/data/devices/ledvance-outdoor-accent-light-rgb.json index 2bce26f86..252d5c466 100644 --- a/tests/data/devices/ledvance-outdoor-accent-light-rgb.json +++ b/tests/data/devices/ledvance-outdoor-accent-light-rgb.json @@ -379,6 +379,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 202, "xy_color": [ @@ -399,8 +400,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/legrand-dimmer-switch-w-o-neutral.json b/tests/data/devices/legrand-dimmer-switch-w-o-neutral.json index 199c709c2..6cb408ded 100644 --- a/tests/data/devices/legrand-dimmer-switch-w-o-neutral.json +++ b/tests/data/devices/legrand-dimmer-switch-w-o-neutral.json @@ -515,6 +515,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 76, "xy_color": null, @@ -530,8 +531,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/legrand-light-switch-with-neutral.json b/tests/data/devices/legrand-light-switch-with-neutral.json index cb5bffdd7..fc9389d9f 100644 --- a/tests/data/devices/legrand-light-switch-with-neutral.json +++ b/tests/data/devices/legrand-light-switch-with-neutral.json @@ -318,6 +318,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -332,8 +333,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-light-aqcn02.json b/tests/data/devices/lumi-lumi-light-aqcn02.json index f35db699c..e82fdb011 100644 --- a/tests/data/devices/lumi-lumi-light-aqcn02.json +++ b/tests/data/devices/lumi-lumi-light-aqcn02.json @@ -409,6 +409,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 178, "xy_color": null, @@ -425,8 +426,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-relay-c2acn01.json b/tests/data/devices/lumi-lumi-relay-c2acn01.json index 3001bce36..766165d90 100644 --- a/tests/data/devices/lumi-lumi-relay-c2acn01.json +++ b/tests/data/devices/lumi-lumi-relay-c2acn01.json @@ -483,6 +483,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -497,8 +498,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -549,6 +549,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -563,8 +564,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-switch-b1laus01.json b/tests/data/devices/lumi-lumi-switch-b1laus01.json index 5a1e3282f..9367b2bf7 100755 --- a/tests/data/devices/lumi-lumi-switch-b1laus01.json +++ b/tests/data/devices/lumi-lumi-switch-b1laus01.json @@ -246,6 +246,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -260,8 +261,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-switch-b1naus01.json b/tests/data/devices/lumi-lumi-switch-b1naus01.json index f56fd69a5..6486fcf86 100755 --- a/tests/data/devices/lumi-lumi-switch-b1naus01.json +++ b/tests/data/devices/lumi-lumi-switch-b1naus01.json @@ -486,6 +486,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -500,8 +501,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-switch-l1aeu1.json b/tests/data/devices/lumi-lumi-switch-l1aeu1.json index fe240dbaf..90ac18440 100644 --- a/tests/data/devices/lumi-lumi-switch-l1aeu1.json +++ b/tests/data/devices/lumi-lumi-switch-l1aeu1.json @@ -260,6 +260,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -274,8 +275,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/lumi-lumi-switch-l2aeu1.json b/tests/data/devices/lumi-lumi-switch-l2aeu1.json index 5778ddc87..495f3a1f7 100644 --- a/tests/data/devices/lumi-lumi-switch-l2aeu1.json +++ b/tests/data/devices/lumi-lumi-switch-l2aeu1.json @@ -298,6 +298,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -312,8 +313,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -364,6 +364,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -378,8 +379,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/mli-tint-extendedcolor.json b/tests/data/devices/mli-tint-extendedcolor.json index 8a2d89de2..3cb724171 100644 --- a/tests/data/devices/mli-tint-extendedcolor.json +++ b/tests/data/devices/mli-tint-extendedcolor.json @@ -401,6 +401,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -422,8 +423,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/philips-7602031u7.json b/tests/data/devices/philips-7602031u7.json index 1cb6751c9..459510535 100644 --- a/tests/data/devices/philips-7602031u7.json +++ b/tests/data/devices/philips-7602031u7.json @@ -443,6 +443,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -464,8 +465,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/philips-lct014.json b/tests/data/devices/philips-lct014.json index dd84cd9f0..81105db84 100644 --- a/tests/data/devices/philips-lct014.json +++ b/tests/data/devices/philips-lct014.json @@ -407,6 +407,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -428,8 +429,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/philips-llc020.json b/tests/data/devices/philips-llc020.json index dfd40f297..509f386de 100644 --- a/tests/data/devices/philips-llc020.json +++ b/tests/data/devices/philips-llc020.json @@ -395,6 +395,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -416,8 +417,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/philips-lst002.json b/tests/data/devices/philips-lst002.json index aaab793bf..edb600e08 100644 --- a/tests/data/devices/philips-lst002.json +++ b/tests/data/devices/philips-lst002.json @@ -421,6 +421,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 1, "xy_color": [ @@ -442,8 +443,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e11-g13.json b/tests/data/devices/sengled-e11-g13.json index 0b301b25c..f3e282fa6 100644 --- a/tests/data/devices/sengled-e11-g13.json +++ b/tests/data/devices/sengled-e11-g13.json @@ -378,6 +378,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -393,8 +394,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e12-n14.json b/tests/data/devices/sengled-e12-n14.json index 23bc39e61..a97b80add 100644 --- a/tests/data/devices/sengled-e12-n14.json +++ b/tests/data/devices/sengled-e12-n14.json @@ -372,6 +372,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": true, "brightness": 255, "xy_color": null, @@ -387,8 +388,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e12-n1e.json b/tests/data/devices/sengled-e12-n1e.json index 09a7d512a..103146cdf 100644 --- a/tests/data/devices/sengled-e12-n1e.json +++ b/tests/data/devices/sengled-e12-n1e.json @@ -485,6 +485,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -505,8 +506,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e1f-n9g.json b/tests/data/devices/sengled-e1f-n9g.json index 67a51a0fe..6fd2a2b03 100644 --- a/tests/data/devices/sengled-e1f-n9g.json +++ b/tests/data/devices/sengled-e1f-n9g.json @@ -387,6 +387,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -402,8 +403,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e1g-g8e.json b/tests/data/devices/sengled-e1g-g8e.json index c6e41c1ab..cd243dc68 100755 --- a/tests/data/devices/sengled-e1g-g8e.json +++ b/tests/data/devices/sengled-e1g-g8e.json @@ -490,6 +490,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": false, "brightness": 26, "xy_color": [ @@ -510,8 +511,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-e21-n1ea.json b/tests/data/devices/sengled-e21-n1ea.json index da3fed973..1d4f6e9d5 100644 --- a/tests/data/devices/sengled-e21-n1ea.json +++ b/tests/data/devices/sengled-e21-n1ea.json @@ -490,6 +490,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": false, "brightness": 86, "xy_color": [ @@ -510,8 +511,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sengled-z01-a19nae26.json b/tests/data/devices/sengled-z01-a19nae26.json index 71b1fe033..afe578465 100644 --- a/tests/data/devices/sengled-z01-a19nae26.json +++ b/tests/data/devices/sengled-z01-a19nae26.json @@ -470,6 +470,7 @@ }, "state": { "class_name": "MinTransitionLight", + "available": true, "on": false, "brightness": 252, "xy_color": null, @@ -486,8 +487,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lca001.json b/tests/data/devices/signify-netherlands-b-v-lca001.json index d33c3af82..6f3b6ab31 100644 --- a/tests/data/devices/signify-netherlands-b-v-lca001.json +++ b/tests/data/devices/signify-netherlands-b-v-lca001.json @@ -424,6 +424,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -445,8 +446,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lca005.json b/tests/data/devices/signify-netherlands-b-v-lca005.json index 920525c8d..2677b8a3d 100644 --- a/tests/data/devices/signify-netherlands-b-v-lca005.json +++ b/tests/data/devices/signify-netherlands-b-v-lca005.json @@ -406,6 +406,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -427,8 +428,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lca007.json b/tests/data/devices/signify-netherlands-b-v-lca007.json index 27aaf324e..c07a1b786 100644 --- a/tests/data/devices/signify-netherlands-b-v-lca007.json +++ b/tests/data/devices/signify-netherlands-b-v-lca007.json @@ -394,6 +394,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -415,8 +416,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lcb001.json b/tests/data/devices/signify-netherlands-b-v-lcb001.json index 6da425822..ad16fce78 100644 --- a/tests/data/devices/signify-netherlands-b-v-lcb001.json +++ b/tests/data/devices/signify-netherlands-b-v-lcb001.json @@ -431,6 +431,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 1, "xy_color": [ @@ -452,8 +453,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lcb002.json b/tests/data/devices/signify-netherlands-b-v-lcb002.json index 45543f9df..4476b83a4 100755 --- a/tests/data/devices/signify-netherlands-b-v-lcb002.json +++ b/tests/data/devices/signify-netherlands-b-v-lcb002.json @@ -394,6 +394,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -415,8 +416,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lce001.json b/tests/data/devices/signify-netherlands-b-v-lce001.json index dd6c096c6..4d5e8cfa9 100644 --- a/tests/data/devices/signify-netherlands-b-v-lce001.json +++ b/tests/data/devices/signify-netherlands-b-v-lce001.json @@ -393,6 +393,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -414,8 +415,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lcx004.json b/tests/data/devices/signify-netherlands-b-v-lcx004.json index 9175b7a33..52b2ea8b4 100644 --- a/tests/data/devices/signify-netherlands-b-v-lcx004.json +++ b/tests/data/devices/signify-netherlands-b-v-lcx004.json @@ -388,6 +388,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 74, "xy_color": [ @@ -409,8 +410,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lta010.json b/tests/data/devices/signify-netherlands-b-v-lta010.json index e1d4eaf0c..85e19dba7 100644 --- a/tests/data/devices/signify-netherlands-b-v-lta010.json +++ b/tests/data/devices/signify-netherlands-b-v-lta010.json @@ -388,6 +388,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 1, "xy_color": null, @@ -404,8 +405,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-ltb003.json b/tests/data/devices/signify-netherlands-b-v-ltb003.json index 1803dbc58..f6d5c568f 100755 --- a/tests/data/devices/signify-netherlands-b-v-ltb003.json +++ b/tests/data/devices/signify-netherlands-b-v-ltb003.json @@ -395,6 +395,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -411,8 +412,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/signify-netherlands-b-v-lwa003.json b/tests/data/devices/signify-netherlands-b-v-lwa003.json index 59aee6ef3..71b99248c 100755 --- a/tests/data/devices/signify-netherlands-b-v-lwa003.json +++ b/tests/data/devices/signify-netherlands-b-v-lwa003.json @@ -290,6 +290,7 @@ }, "state": { "class_name": "HueLight", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -305,8 +306,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sonoff-01minizb.json b/tests/data/devices/sonoff-01minizb.json index 2bf6e3de6..7f2a0572c 100644 --- a/tests/data/devices/sonoff-01minizb.json +++ b/tests/data/devices/sonoff-01minizb.json @@ -216,6 +216,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -230,8 +231,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sonoff-basiczbr3.json b/tests/data/devices/sonoff-basiczbr3.json index 2bbdac24f..b9815b16f 100644 --- a/tests/data/devices/sonoff-basiczbr3.json +++ b/tests/data/devices/sonoff-basiczbr3.json @@ -196,6 +196,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -210,8 +211,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sonoff-dongle-e-r.json b/tests/data/devices/sonoff-dongle-e-r.json index 14e297bc5..1cd404615 100644 --- a/tests/data/devices/sonoff-dongle-e-r.json +++ b/tests/data/devices/sonoff-dongle-e-r.json @@ -434,6 +434,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 51, "xy_color": null, @@ -449,8 +450,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -529,6 +529,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 51, "xy_color": null, @@ -545,8 +546,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sunricher-hk-ln-dim-a.json b/tests/data/devices/sunricher-hk-ln-dim-a.json index bd8df550a..8e58c28c6 100644 --- a/tests/data/devices/sunricher-hk-ln-dim-a.json +++ b/tests/data/devices/sunricher-hk-ln-dim-a.json @@ -314,6 +314,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 184, "xy_color": null, @@ -329,8 +330,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/sunricher-on-off-2ch.json b/tests/data/devices/sunricher-on-off-2ch.json index d853c986b..ed4a6ae93 100644 --- a/tests/data/devices/sunricher-on-off-2ch.json +++ b/tests/data/devices/sunricher-on-off-2ch.json @@ -663,6 +663,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -677,8 +678,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -729,6 +729,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -743,8 +744,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/the-home-depot-ecosmart-zbt-a19-cct-bulb.json b/tests/data/devices/the-home-depot-ecosmart-zbt-a19-cct-bulb.json index fa8d73406..bd56e734d 100644 --- a/tests/data/devices/the-home-depot-ecosmart-zbt-a19-cct-bulb.json +++ b/tests/data/devices/the-home-depot-ecosmart-zbt-a19-cct-bulb.json @@ -422,6 +422,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -438,8 +439,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/third-reality-inc-3rsnl02043z.json b/tests/data/devices/third-reality-inc-3rsnl02043z.json index 4f0eb9de4..abec88167 100644 --- a/tests/data/devices/third-reality-inc-3rsnl02043z.json +++ b/tests/data/devices/third-reality-inc-3rsnl02043z.json @@ -496,6 +496,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -517,8 +518,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tyzb01-rifa0wlb-ts0011.json b/tests/data/devices/tyzb01-rifa0wlb-ts0011.json index 34bf52c85..6b44cf8f9 100755 --- a/tests/data/devices/tyzb01-rifa0wlb-ts0011.json +++ b/tests/data/devices/tyzb01-rifa0wlb-ts0011.json @@ -210,6 +210,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -224,8 +225,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-09gto2zn-ts0013.json b/tests/data/devices/tz3000-09gto2zn-ts0013.json index a08fb1a76..477aa272a 100644 --- a/tests/data/devices/tz3000-09gto2zn-ts0013.json +++ b/tests/data/devices/tz3000-09gto2zn-ts0013.json @@ -314,6 +314,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -328,8 +329,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -380,6 +380,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -394,8 +395,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -446,6 +446,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -460,8 +461,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-idhkkbqj-ts0012.json b/tests/data/devices/tz3000-idhkkbqj-ts0012.json index 45e82fd6f..149367af0 100644 --- a/tests/data/devices/tz3000-idhkkbqj-ts0012.json +++ b/tests/data/devices/tz3000-idhkkbqj-ts0012.json @@ -277,6 +277,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": null, "xy_color": null, @@ -291,8 +292,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -343,6 +343,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": null, "xy_color": null, @@ -357,8 +358,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-rbl8c85w-ts0012.json b/tests/data/devices/tz3000-rbl8c85w-ts0012.json index 6ab78dd25..90f89aba7 100644 --- a/tests/data/devices/tz3000-rbl8c85w-ts0012.json +++ b/tests/data/devices/tz3000-rbl8c85w-ts0012.json @@ -282,6 +282,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -296,8 +297,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -348,6 +348,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -362,8 +363,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-tgddllx4-ts0001.json b/tests/data/devices/tz3000-tgddllx4-ts0001.json index d2c99fd1b..f6a6ed5c4 100644 --- a/tests/data/devices/tz3000-tgddllx4-ts0001.json +++ b/tests/data/devices/tz3000-tgddllx4-ts0001.json @@ -430,6 +430,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": null, "xy_color": null, @@ -444,8 +445,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-u4kojtqz-ts0002.json b/tests/data/devices/tz3000-u4kojtqz-ts0002.json index 3be4f9908..98edd32fb 100644 --- a/tests/data/devices/tz3000-u4kojtqz-ts0002.json +++ b/tests/data/devices/tz3000-u4kojtqz-ts0002.json @@ -324,6 +324,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -338,8 +339,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -390,6 +390,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -404,8 +405,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3000-zw7yf6yk-ts0001.json b/tests/data/devices/tz3000-zw7yf6yk-ts0001.json index 2f09f18c9..5b06f09e5 100644 --- a/tests/data/devices/tz3000-zw7yf6yk-ts0001.json +++ b/tests/data/devices/tz3000-zw7yf6yk-ts0001.json @@ -476,6 +476,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -490,8 +491,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-09hzmirw-ts0502b.json b/tests/data/devices/tz3210-09hzmirw-ts0502b.json index dd89d01a6..31e2be068 100644 --- a/tests/data/devices/tz3210-09hzmirw-ts0502b.json +++ b/tests/data/devices/tz3210-09hzmirw-ts0502b.json @@ -375,6 +375,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 56, "xy_color": null, @@ -391,8 +392,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-3mpwqzuu-ts110e.json b/tests/data/devices/tz3210-3mpwqzuu-ts110e.json index 416ae6e6d..1b475c903 100644 --- a/tests/data/devices/tz3210-3mpwqzuu-ts110e.json +++ b/tests/data/devices/tz3210-3mpwqzuu-ts110e.json @@ -428,6 +428,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -443,8 +444,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -509,6 +509,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -524,8 +525,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-bfwvfyx1-ts0505b.json b/tests/data/devices/tz3210-bfwvfyx1-ts0505b.json index ec2922f99..be260c274 100644 --- a/tests/data/devices/tz3210-bfwvfyx1-ts0505b.json +++ b/tests/data/devices/tz3210-bfwvfyx1-ts0505b.json @@ -375,6 +375,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -395,8 +396,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-comkuwws-ts0502b.json b/tests/data/devices/tz3210-comkuwws-ts0502b.json index bdf9a052b..1d0b910c5 100644 --- a/tests/data/devices/tz3210-comkuwws-ts0502b.json +++ b/tests/data/devices/tz3210-comkuwws-ts0502b.json @@ -375,6 +375,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 64, "xy_color": null, @@ -391,8 +392,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-ehcanwyc-ts0502b.json b/tests/data/devices/tz3210-ehcanwyc-ts0502b.json index 231468d6c..423b1fe2e 100644 --- a/tests/data/devices/tz3210-ehcanwyc-ts0502b.json +++ b/tests/data/devices/tz3210-ehcanwyc-ts0502b.json @@ -399,6 +399,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -415,8 +416,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-jaap6jeb-ts0505b.json b/tests/data/devices/tz3210-jaap6jeb-ts0505b.json index c9ca9178d..20c5a5e2c 100644 --- a/tests/data/devices/tz3210-jaap6jeb-ts0505b.json +++ b/tests/data/devices/tz3210-jaap6jeb-ts0505b.json @@ -429,6 +429,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": [ @@ -449,8 +450,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-k1msuvg6-ts110e.json b/tests/data/devices/tz3210-k1msuvg6-ts110e.json index ea8edca6b..2013ca19a 100644 --- a/tests/data/devices/tz3210-k1msuvg6-ts110e.json +++ b/tests/data/devices/tz3210-k1msuvg6-ts110e.json @@ -392,6 +392,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -407,8 +408,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-r5afgmkl-ts0505b.json b/tests/data/devices/tz3210-r5afgmkl-ts0505b.json index 34c775335..2cea344a0 100644 --- a/tests/data/devices/tz3210-r5afgmkl-ts0505b.json +++ b/tests/data/devices/tz3210-r5afgmkl-ts0505b.json @@ -365,6 +365,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 254, "xy_color": [ @@ -385,8 +386,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3210-u1dreag7-ts0502b.json b/tests/data/devices/tz3210-u1dreag7-ts0502b.json index 06372967f..861e7491a 100644 --- a/tests/data/devices/tz3210-u1dreag7-ts0502b.json +++ b/tests/data/devices/tz3210-u1dreag7-ts0502b.json @@ -393,6 +393,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -409,8 +410,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3218-7fiyo3kv-ts000f.json b/tests/data/devices/tz3218-7fiyo3kv-ts000f.json index 7432b3608..b99bc9d7c 100644 --- a/tests/data/devices/tz3218-7fiyo3kv-ts000f.json +++ b/tests/data/devices/tz3218-7fiyo3kv-ts000f.json @@ -238,6 +238,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -252,8 +253,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tz3218-ya5d6wth-ts000f.json b/tests/data/devices/tz3218-ya5d6wth-ts000f.json index 69fda26c8..8a773791a 100644 --- a/tests/data/devices/tz3218-ya5d6wth-ts000f.json +++ b/tests/data/devices/tz3218-ya5d6wth-ts000f.json @@ -382,6 +382,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -396,8 +397,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -448,6 +448,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -462,8 +463,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -514,6 +514,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -528,8 +529,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -580,6 +580,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -594,8 +595,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tze204-1v1dxkck-ts0601.json b/tests/data/devices/tze204-1v1dxkck-ts0601.json index 4ae0df5b9..43a1860ba 100644 --- a/tests/data/devices/tze204-1v1dxkck-ts0601.json +++ b/tests/data/devices/tze204-1v1dxkck-ts0601.json @@ -302,6 +302,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -317,8 +318,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -383,6 +383,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -398,8 +399,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -464,6 +464,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -479,8 +480,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tze204-58of2pfn-ts0601.json b/tests/data/devices/tze204-58of2pfn-ts0601.json index 45087bf6b..cc5cfdce9 100644 --- a/tests/data/devices/tze204-58of2pfn-ts0601.json +++ b/tests/data/devices/tze204-58of2pfn-ts0601.json @@ -305,6 +305,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -319,8 +320,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -371,6 +371,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -385,8 +386,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -437,6 +437,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -451,8 +452,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", @@ -503,6 +503,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -517,8 +518,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/tze204-nqqylykc-ts0601.json b/tests/data/devices/tze204-nqqylykc-ts0601.json index 9a684bc12..79a8f6028 100644 --- a/tests/data/devices/tze204-nqqylykc-ts0601.json +++ b/tests/data/devices/tze204-nqqylykc-ts0601.json @@ -260,6 +260,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -275,8 +276,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/zbeacon-ts0001.json b/tests/data/devices/zbeacon-ts0001.json index 9e7def39f..76fd8e5b6 100644 --- a/tests/data/devices/zbeacon-ts0001.json +++ b/tests/data/devices/zbeacon-ts0001.json @@ -233,6 +233,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": null, "xy_color": null, @@ -247,8 +248,7 @@ "onoff" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/data/devices/zbeacon-ts0505.json b/tests/data/devices/zbeacon-ts0505.json index 2100c3aba..5a4646281 100644 --- a/tests/data/devices/zbeacon-ts0505.json +++ b/tests/data/devices/zbeacon-ts0505.json @@ -374,6 +374,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": true, "brightness": 126, "xy_color": [ @@ -394,8 +395,7 @@ "xy" ], "off_with_transition": false, - "off_brightness": null, - "available": true + "off_brightness": null }, "extra_state_attributes": [ "off_brightness", diff --git a/tests/test_light.py b/tests/test_light.py index ff2abb4cd..01875a8bf 100644 --- a/tests/test_light.py +++ b/tests/test_light.py @@ -31,12 +31,7 @@ from zha.application import Platform from zha.application.gateway import Gateway from zha.application.platforms import GroupEntity, PlatformEntity -from zha.application.platforms.light.const import ( - FLASH_EFFECTS, - FLASH_LONG, - FLASH_SHORT, - ColorMode, -) +from zha.application.platforms.light.const import FLASH_EFFECTS, ColorMode, FlashMode from zha.zigbee.device import Device from zha.zigbee.group import Group, GroupMemberReference @@ -408,7 +403,7 @@ async def test_light( # test short flashing the lights from the client if cluster_identify: await async_test_flash_from_client( - zha_gateway, cluster_identify, entity, FLASH_SHORT + zha_gateway, cluster_identify, entity, FlashMode.SHORT ) await _async_shift_time(zha_gateway) @@ -431,11 +426,11 @@ async def test_light( # test long flashing the lights from the client if cluster_identify: await async_test_flash_from_client( - zha_gateway, cluster_identify, entity, FLASH_LONG + zha_gateway, cluster_identify, entity, FlashMode.LONG ) await _async_shift_time(zha_gateway) await async_test_flash_from_client( - zha_gateway, cluster_identify, entity, FLASH_SHORT + zha_gateway, cluster_identify, entity, FlashMode.SHORT ) await _async_shift_time(zha_gateway) @@ -846,12 +841,12 @@ async def test_zha_group_light_entity( # test short flashing the lights from the client await async_test_flash_from_client( - zha_gateway, group_cluster_identify, entity, FLASH_SHORT + zha_gateway, group_cluster_identify, entity, FlashMode.SHORT ) await _async_shift_time(zha_gateway) # test long flashing the lights from the client await async_test_flash_from_client( - zha_gateway, group_cluster_identify, entity, FLASH_LONG + zha_gateway, group_cluster_identify, entity, FlashMode.LONG ) await _async_shift_time(zha_gateway) @@ -1814,7 +1809,7 @@ async def test_on_with_off_color(zha_gateway: Gateway) -> None: assert entity.state["color_temp"] == 235 assert entity.state["color_mode"] == ColorMode.COLOR_TEMP assert entity.supported_color_modes == {ColorMode.COLOR_TEMP, ColorMode.XY} - assert entity._supported_color_modes == { + assert entity._internal_supported_color_modes == { ColorMode.COLOR_TEMP, ColorMode.XY, ColorMode.ONOFF, diff --git a/zha/application/platforms/light/__init__.py b/zha/application/platforms/light/__init__.py index 8dc4654f9..713cd5134 100644 --- a/zha/application/platforms/light/__init__.py +++ b/zha/application/platforms/light/__init__.py @@ -39,12 +39,10 @@ ATTR_COLOR_TEMP, ATTR_EFFECT, ATTR_EFFECT_LIST, - ATTR_FLASH, ATTR_MAX_MIREDS, ATTR_MIN_MIREDS, ATTR_SUPPORTED_COLOR_MODES, ATTR_SUPPORTED_FEATURES, - ATTR_TRANSITION, ATTR_XY_COLOR, DEFAULT_EXTRA_TRANSITION_DELAY_LONG, DEFAULT_EXTRA_TRANSITION_DELAY_SHORT, @@ -56,6 +54,7 @@ EFFECT_OFF, FLASH_EFFECTS, ColorMode, + FlashMode, LightEntityFeature, ) from zha.application.platforms.light.helpers import ( @@ -82,6 +81,7 @@ from zha.zigbee.cluster_handlers.lighting import ColorClusterHandler if TYPE_CHECKING: + from zha.application.gateway import Gateway from zha.zigbee.cluster_handlers import ClusterHandler from zha.zigbee.device import Device from zha.zigbee.endpoint import Endpoint @@ -107,8 +107,6 @@ class BaseLight(BaseEntity, ABC): """Operations common to all light entities.""" PLATFORM = Platform.LIGHT - _FORCE_ON = False - _DEFAULT_MIN_TRANSITION_TIME: float = 0 _attr_extra_state_attribute_names: set[str] = { "off_with_transition", "off_brightness", @@ -131,17 +129,6 @@ def __init__(self, *args, **kwargs): self._effect_list: list[str] | None = None self._effect: str = EFFECT_OFF self._supported_color_modes: set[ColorMode] = set() - self._external_supported_color_modes: set[ColorMode] = set() - self._zha_config_transition: float = self._DEFAULT_MIN_TRANSITION_TIME - self._zha_config_enhanced_light_transition: bool = False - self._zha_config_enable_light_transitioning_flag: bool = True - self._on_off_cluster_handler: OnOffClusterHandler | None = None - self._level_cluster_handler: LevelControlClusterHandler | None = None - self._color_cluster_handler: ColorClusterHandler | None = None - self._identify_cluster_handler: IdentifyClusterHandler | None = None - self._transitioning_individual: bool = False - self._transitioning_group: bool = False - self._transition_listener: asyncio.TimerHandle | None = None @property def state(self) -> dict[str, Any]: @@ -155,11 +142,22 @@ def state(self) -> dict[str, Any]: response["effect"] = self.effect response["supported_features"] = self.supported_features response["color_mode"] = self.color_mode - response["supported_color_modes"] = self._supported_color_modes + response["supported_color_modes"] = self.supported_color_modes response["off_with_transition"] = self._off_with_transition response["off_brightness"] = self._off_brightness return response + @functools.cached_property + def info_object(self) -> LightEntityInfo: + """Return a representation of the select.""" + return LightEntityInfo( + **super().info_object.__dict__, + effect_list=self.effect_list, + supported_features=self.supported_features, + min_mireds=self.min_mireds, + max_mireds=self.max_mireds, + ) + @property def xy_color(self) -> tuple[float, float] | None: """Return the xy color value [float, float].""" @@ -193,7 +191,7 @@ def supported_features(self) -> LightEntityFeature: @property def supported_color_modes(self) -> set[ColorMode]: """Flag supported color modes.""" - return self._external_supported_color_modes + return self._supported_color_modes @property def is_on(self) -> bool: @@ -217,37 +215,118 @@ def max_mireds(self) -> int | None: """Return the warmest color_temp that this light supports.""" return self._max_mireds - def handle_cluster_handler_set_level(self, event: LevelChangeEvent) -> None: - """Set the brightness of this light between 0..254. + async def async_turn_on( + self, + *, + transition: float | None = None, + brightness: int | None = None, + effect: str | None = None, + flash: FlashMode | None = None, + color_temp: int | None = None, + xy_color: tuple[int, int] | None = None, + ) -> None: + """Turn the entity on.""" + raise NotImplementedError - brightness level 255 is a special value instructing the device to come - on at `on_level` Zigbee attribute value, regardless of the last set - level - """ - if self.is_transitioning: - self.debug( - "received level change event %s while transitioning - skipping update", - event, - ) - return - value = max(0, min(254, event.level)) - self._brightness = value - self.maybe_emit_state_changed_event() + async def async_turn_off(self, *, transition: float | None = None) -> None: + """Turn the entity off.""" + raise NotImplementedError - async def async_turn_on(self, **kwargs: Any) -> None: + def restore_external_state_attributes( + self, + *, + state: bool | None, + off_with_transition: bool | None, + off_brightness: int | None, + brightness: int | None, + color_temp: int | None, + xy_color: tuple[float, float] | None, + color_mode: ColorMode | None, + effect: str | None, + ) -> None: + """Restore extra state attributes that are stored outside of the ZCL cache.""" + if state is not None: + self._state = state + if off_with_transition is not None: + self._off_with_transition = off_with_transition + if off_brightness is not None: + self._off_brightness = off_brightness + if brightness is not None: + self._brightness = brightness + if color_temp is not None: + self._color_temp = color_temp + if xy_color is not None: + self._xy_color = xy_color + if color_mode is not None: + self._color_mode = color_mode + if effect is not None: + self._effect = effect + + +class BaseClusterHandlerLight(BaseLight): + """Operations common to all light entities.""" + + _FORCE_ON = False + _DEFAULT_MIN_TRANSITION_TIME: float = 0 + + def __init__(self, *args, **kwargs): + """Initialize the light.""" + super().__init__(*args, **kwargs) + self._zha_config_transition: float = self._DEFAULT_MIN_TRANSITION_TIME + self._zha_config_enhanced_light_transition: bool = False + self._zha_config_enable_light_transitioning_flag: bool = True + self._on_off_cluster_handler: OnOffClusterHandler | None = None + self._level_cluster_handler: LevelControlClusterHandler | None = None + self._color_cluster_handler: ColorClusterHandler | None = None + self._identify_cluster_handler: IdentifyClusterHandler | None = None + self._transitioning_individual: bool = False + self._transitioning_group: bool = False + self._transition_listener: asyncio.TimerHandle | None = None + + self._internal_supported_color_modes: set[ColorMode] = set() + + @property + def _gateway(self) -> Gateway: + """Return the gateway.""" + raise NotImplementedError + + @property + def state(self) -> dict[str, Any]: + """Return the state of the light.""" + response = super().state + # XXX: for backwards compatibility + response["supported_color_modes"] = self._internal_supported_color_modes + return response + + def recompute_capabilities(self) -> None: + """Recompute supported features and color modes.""" + super().recompute_capabilities() + light_options = self._gateway.config.config.light_options + self._zha_config_transition = light_options.default_light_transition + self._zha_config_enhanced_light_transition = ( + light_options.enable_enhanced_light_transition + ) + self._zha_config_enable_light_transitioning_flag = ( + light_options.enable_light_transitioning_flag + ) + + async def async_turn_on( + self, + *, + transition: float | None = None, + brightness: int | None = None, + effect: str | None = None, + flash: FlashMode | None = None, + color_temp: int | None = None, + xy_color: tuple[int, int] | None = None, + ) -> None: """Turn the entity on.""" - transition = kwargs.get(ATTR_TRANSITION) duration = ( transition if transition is not None else self._zha_config_transition ) or ( # if 0 is passed in some devices still need the minimum default self._DEFAULT_MIN_TRANSITION_TIME ) - brightness = kwargs.get(ATTR_BRIGHTNESS) - effect = kwargs.get(ATTR_EFFECT) - flash = kwargs.get(ATTR_FLASH) - temperature = kwargs.get(ATTR_COLOR_TEMP) - xy_color = kwargs.get(ATTR_XY_COLOR) execute_if_off_supported = ( self._GROUP_SUPPORTS_EXECUTE_IF_OFF @@ -259,12 +338,12 @@ async def async_turn_on(self, **kwargs: Any) -> None: # A device theoretically could lie about having brightness support and omit the # actual LevelControl cluster needed to control it brightness_supported = ( - is_brightness_supported(self._supported_color_modes) + is_brightness_supported(self._internal_supported_color_modes) and self._level_cluster_handler is not None ) set_transition_flag = ( - brightness_supported or temperature is not None or xy_color is not None + brightness_supported or color_temp is not None or xy_color is not None ) and self._zha_config_enable_light_transitioning_flag transition_time = ( ( @@ -273,7 +352,7 @@ async def async_turn_on(self, **kwargs: Any) -> None: (brightness is not None or transition is not None) and brightness_supported or (self._off_with_transition and self._off_brightness is not None) - or temperature is not None + or color_temp is not None or xy_color is not None ) else DEFAULT_ON_OFF_TRANSITION + DEFAULT_EXTRA_TRANSITION_DELAY_SHORT @@ -309,9 +388,9 @@ async def async_turn_on(self, **kwargs: Any) -> None: and not self._state and ( ( - temperature is not None + color_temp is not None and ( - self._color_temp != temperature + self._color_temp != color_temp or self._color_mode != ColorMode.COLOR_TEMP ) ) @@ -364,7 +443,7 @@ async def async_turn_on(self, **kwargs: Any) -> None: if execute_if_off_supported: self.debug("handling color commands before turning on/level") if not await self.async_handle_color_commands( - temperature, + color_temp, duration, # duration is ignored by lights when off xy_color, new_color_provided_while_off, @@ -425,7 +504,7 @@ async def async_turn_on(self, **kwargs: Any) -> None: if not execute_if_off_supported: self.debug("handling color commands after turning on/level") if not await self.async_handle_color_commands( - temperature, + color_temp, duration, xy_color, new_color_provided_while_off, @@ -497,11 +576,10 @@ async def async_turn_on(self, **kwargs: Any) -> None: self.debug("turned on: %s", t_log) self.maybe_emit_state_changed_event() - async def async_turn_off(self, **kwargs: Any) -> None: + async def async_turn_off(self, *, transition: float | None = None) -> None: """Turn the entity off.""" - transition = kwargs.get(ATTR_TRANSITION) brightness_supported = ( - is_brightness_supported(self._supported_color_modes) + is_brightness_supported(self._internal_supported_color_modes) and self._level_cluster_handler is not None ) @@ -553,7 +631,7 @@ async def async_turn_off(self, **kwargs: Any) -> None: async def async_handle_color_commands( self, - temperature, + color_temp, duration, xy_color, new_color_provided_while_off, @@ -566,18 +644,18 @@ async def async_handle_color_commands( else duration ) - if temperature is not None: + if color_temp is not None: assert self._color_cluster_handler is not None result = await self._color_cluster_handler.move_to_color_temp( - color_temp_mireds=temperature, + color_temp_mireds=color_temp, transition_time=int(10 * transition_time), ) t_log["move_to_color_temp"] = result if result[1] is not Status.SUCCESS: return False self._color_mode = ColorMode.COLOR_TEMP - self._color_temp = temperature + self._color_temp = color_temp self._xy_color = None if xy_color is not None: @@ -669,11 +747,9 @@ async def on_remove(self) -> None: cluster_handler_names=CLUSTER_HANDLER_ON_OFF, aux_cluster_handlers={CLUSTER_HANDLER_COLOR, CLUSTER_HANDLER_LEVEL}, ) -class Light(PlatformEntity, BaseLight): +class Light(BaseClusterHandlerLight, PlatformEntity): """Representation of a ZHA or ZLL light.""" - _supported_color_modes: set[ColorMode] - _external_supported_color_modes: set[ColorMode] _attr_translation_key: str = "light" _REFRESH_INTERVAL = (2700, 4500) __polling_interval: int @@ -701,22 +777,15 @@ def __init__( self._identify_cluster_handler: IdentifyClusterHandler | None = cast( IdentifyClusterHandler | None, device.identify_ch ) - if self._color_cluster_handler: - self._min_mireds: int = self._color_cluster_handler.min_mireds - self._max_mireds: int = self._color_cluster_handler.max_mireds - light_options = self.device.gateway.config.config.light_options - self._zha_config_transition = light_options.default_light_transition - self._zha_config_enhanced_light_transition = ( - light_options.enable_enhanced_light_transition - ) - self._zha_config_enable_light_transitioning_flag = ( - light_options.enable_light_transitioning_flag - ) self._refresh_task: asyncio.Task | None = None self.recompute_capabilities() + @property + def _gateway(self) -> Gateway: + return self._device.gateway + def on_add(self) -> None: """Run when entity is added.""" super().on_add() @@ -739,21 +808,25 @@ def on_add(self) -> None: def recompute_capabilities(self) -> None: """Recompute capabilities.""" super().recompute_capabilities() + effect_list = [EFFECT_OFF] - self._supported_color_modes = {ColorMode.ONOFF} + self._internal_supported_color_modes = {ColorMode.ONOFF} if self._level_cluster_handler: - self._supported_color_modes.add(ColorMode.BRIGHTNESS) + self._internal_supported_color_modes.add(ColorMode.BRIGHTNESS) self._supported_features |= LightEntityFeature.TRANSITION self._brightness = self._level_cluster_handler.current_level if self._color_cluster_handler: + self._min_mireds: int = self._color_cluster_handler.min_mireds + self._max_mireds: int = self._color_cluster_handler.max_mireds + if self._color_cluster_handler.color_temp_supported: - self._supported_color_modes.add(ColorMode.COLOR_TEMP) + self._internal_supported_color_modes.add(ColorMode.COLOR_TEMP) self._color_temp = self._color_cluster_handler.color_temperature if self._color_cluster_handler.xy_supported: - self._supported_color_modes.add(ColorMode.XY) + self._internal_supported_color_modes.add(ColorMode.XY) curr_x = self._color_cluster_handler.current_x curr_y = self._color_cluster_handler.current_y if curr_x is not None and curr_y is not None: @@ -767,8 +840,8 @@ def recompute_capabilities(self) -> None: if self._color_cluster_handler.color_loop_active == 1: self._effect = EFFECT_COLORLOOP - self._external_supported_color_modes = supported_color_modes = ( - filter_supported_color_modes(self._supported_color_modes) + self._supported_color_modes = supported_color_modes = ( + filter_supported_color_modes(self._internal_supported_color_modes) ) if len(supported_color_modes) == 1: self._color_mode = next(iter(supported_color_modes)) @@ -787,16 +860,22 @@ def recompute_capabilities(self) -> None: self._effect_list = effect_list - @functools.cached_property - def info_object(self) -> LightEntityInfo: - """Return a representation of the select.""" - return LightEntityInfo( - **super().info_object.__dict__, - effect_list=self.effect_list, - supported_features=self.supported_features, - min_mireds=self.min_mireds, - max_mireds=self.max_mireds, - ) + def handle_cluster_handler_set_level(self, event: LevelChangeEvent) -> None: + """Set the brightness of this light between 0..254. + + brightness level 255 is a special value instructing the device to come + on at `on_level` Zigbee attribute value, regardless of the last set + level + """ + if self.is_transitioning: + self.debug( + "received level change event %s while transitioning - skipping update", + event, + ) + return + value = max(0, min(254, event.level)) + self._brightness = value + self.maybe_emit_state_changed_event() def start_polling(self) -> None: """Start polling.""" @@ -943,98 +1022,6 @@ async def async_update(self) -> None: self._effect = EFFECT_OFF self.maybe_emit_state_changed_event() - def _assume_group_state(self, update_params) -> None: - """Handle an assume group state event from a group.""" - if self.available: - self.debug("member assuming group state with: %s", update_params) - - state = update_params["state"] - brightness = update_params.get(ATTR_BRIGHTNESS) - color_mode = update_params.get(ATTR_COLOR_MODE) - color_temp = update_params.get(ATTR_COLOR_TEMP) - xy_color = update_params.get(ATTR_XY_COLOR) - effect = update_params.get(ATTR_EFFECT) - - supported_modes = self._supported_color_modes - effect_list = self._effect_list - - brightness_supported = ( - is_brightness_supported(supported_modes) - and self._level_cluster_handler is not None - ) - - # unset "off brightness" and "off with transition" - # if group turned on this light - if state and not self._state: - self._off_with_transition = False - self._off_brightness = None - - # set "off brightness" and "off with transition" - # if group turned off this light, and the light was not already off - # (to not override _off_with_transition) - elif not state and self._state and brightness_supported: - # use individual brightness, instead of possibly averaged - # brightness from group - self._off_brightness = self._brightness - self._off_with_transition = update_params["off_with_transition"] - - # Note: If individual lights have off_with_transition set, but not the - # group, and the group is then turned on without a level, individual lights - # might fall back to brightness level 1. - # Since all lights might need different brightness levels to be turned on, - # we can't use one group call. And making individual calls when turning on - # a ZHA group would cause a lot of traffic. In this case, - # turn_on should either just be called with a level or individual turn_on - # calls can be used. - - # state is always set (turn_on/turn_off) - self._state = state - - # before assuming a group state attribute, check if the attribute - # was actually set in that call - if brightness is not None and brightness_supported: - self._brightness = brightness - if color_mode is not None and color_mode in supported_modes: - self._color_mode = color_mode - if color_temp is not None and ColorMode.COLOR_TEMP in supported_modes: - self._color_temp = color_temp - if xy_color is not None and ColorMode.XY in supported_modes: - self._xy_color = xy_color - if effect is not None and effect_list and effect in effect_list: - self._effect = effect - - self.maybe_emit_state_changed_event() - - def restore_external_state_attributes( - self, - *, - state: bool | None, - off_with_transition: bool | None, - off_brightness: int | None, - brightness: int | None, - color_temp: int | None, - xy_color: tuple[float, float] | None, - color_mode: ColorMode | None, - effect: str | None, - ) -> None: - """Restore extra state attributes that are stored outside of the ZCL cache.""" - if state is not None: - self._state = state - if off_with_transition is not None: - self._off_with_transition = off_with_transition - if off_brightness is not None: - self._off_brightness = off_brightness - if brightness is not None: - self._brightness = brightness - if color_temp is not None: - self._color_temp = color_temp - if xy_color is not None: - self._xy_color = xy_color - if color_mode is not None: - self._color_mode = color_mode - if effect is not None: - self._effect = effect - @STRICT_MATCH( cluster_handler_names=CLUSTER_HANDLER_ON_OFF, @@ -1071,7 +1058,7 @@ class MinTransitionLight(Light): @GROUP_MATCH() -class LightGroup(GroupEntity, BaseLight): +class LightGroup(BaseClusterHandlerLight, GroupEntity): """Representation of a light group.""" _attr_always_supported = True @@ -1107,21 +1094,23 @@ def __init__(self, group: Group): self.recompute_capabilities() + @property + def _gateway(self) -> Gateway: + return self.group.gateway + def recompute_capabilities(self) -> None: """Recompute capabilities.""" super().recompute_capabilities() - light_options = self.group.gateway.config.config.light_options + + light_options = self._gateway.config.config.light_options self._zha_config_group_members_assume_state = ( light_options.group_members_assume_state ) - self._zha_config_transition = light_options.default_light_transition - self._zha_config_enable_light_transitioning_flag = ( - light_options.enable_light_transitioning_flag - ) + self._zha_config_enhanced_light_transition = False self._GROUP_SUPPORTS_EXECUTE_IF_OFF: bool = True - if self.group.gateway.config.config.light_options.group_members_assume_state: + if light_options.group_members_assume_state: self._change_listener_debouncer.cooldown = ( ASSUME_UPDATE_GROUP_FROM_CHILD_DELAY ) @@ -1151,23 +1140,12 @@ def recompute_capabilities(self) -> None: break self._color_mode = ColorMode.UNKNOWN - self._supported_color_modes = {ColorMode.ONOFF} + self._internal_supported_color_modes = {ColorMode.ONOFF} if hasattr(self, "info_object"): delattr(self, "info_object") self.update() - @functools.cached_property - def info_object(self) -> LightEntityInfo: - """Return a representation of the select.""" - return LightEntityInfo( - **super().info_object.__dict__, - effect_list=self.effect_list, - supported_features=self.supported_features, - min_mireds=self.min_mireds, - max_mireds=self.max_mireds, - ) - async def on_remove(self) -> None: """Cancel tasks this entity owns.""" await super().on_remove() @@ -1182,7 +1160,9 @@ async def async_turn_on(self, **kwargs: Any) -> None: off_brightness = self._off_brightness if self._off_with_transition else None await super().async_turn_on(**kwargs) if self._zha_config_group_members_assume_state: - self._make_members_assume_group_state(True, kwargs, off_brightness) + self._make_members_assume_group_state( + state=True, off_brightness=off_brightness, **kwargs + ) if self.is_transitioning: # when transitioning, state is refreshed at the end return if self._debounced_member_refresh: @@ -1192,7 +1172,7 @@ async def async_turn_off(self, **kwargs: Any) -> None: """Turn the entity off.""" await super().async_turn_off(**kwargs) if self._zha_config_group_members_assume_state: - self._make_members_assume_group_state(False, kwargs) + self._make_members_assume_group_state(state=False, **kwargs) if self.is_transitioning: return if self._debounced_member_refresh: @@ -1243,11 +1223,11 @@ def update(self, _: Any = None) -> None: all_supported_color_modes: list[set[ColorMode]] = list( find_state_attributes(states, ATTR_SUPPORTED_COLOR_MODES) ) - self._supported_color_modes = set().union(*all_supported_color_modes) + self._internal_supported_color_modes = set().union(*all_supported_color_modes) if all_supported_color_modes: # Merge all color modes. - self._external_supported_color_modes = supported_color_modes = ( + self._supported_color_modes = supported_color_modes = ( filter_supported_color_modes(set().union(*all_supported_color_modes)) ) @@ -1291,37 +1271,109 @@ async def _force_member_updates(self) -> None: await platform_entity.async_update() def _make_members_assume_group_state( - self, state, service_kwargs, off_brightness=None + self, + *, + state: bool, + off_brightness: int | None = None, + # The rest are service call kwargs + transition: float | None = None, + brightness: int | None = None, + effect: str | None = None, + flash: FlashMode | None = None, + color_temp: int | None = None, + xy_color: tuple[int, int] | None = None, ) -> None: """Send an assume event to all members of the group.""" - update_params = { - "state": state, - "off_with_transition": self._off_with_transition, - } # check if the parameters were actually updated # in the service call before updating members - if service_kwargs.get(ATTR_BRIGHTNESS) is not None: # or off brightness - update_params[ATTR_BRIGHTNESS] = self._brightness + if brightness is not None: # or off brightness + assumed_brightness = self._brightness elif off_brightness is not None: # if we turn on the group light with "off brightness", # pass that to the members - update_params[ATTR_BRIGHTNESS] = off_brightness + assumed_brightness = off_brightness + else: + assumed_brightness = None - if service_kwargs.get(ATTR_COLOR_TEMP) is not None: - update_params[ATTR_COLOR_MODE] = self._color_mode - update_params[ATTR_COLOR_TEMP] = self._color_temp + if color_temp is not None: + assumed_color_mode = self._color_mode + assumed_color_temp = self._color_temp + else: + assumed_color_mode = None + assumed_color_temp = None - if service_kwargs.get(ATTR_XY_COLOR) is not None: - update_params[ATTR_COLOR_MODE] = self._color_mode - update_params[ATTR_XY_COLOR] = self._xy_color + if xy_color is not None: + assumed_color_mode = self._color_mode + assumed_xy_color = self._xy_color + else: + assumed_color_mode = None + assumed_xy_color = None # setting any other attribute will turn the effect off, so we always set this - update_params[ATTR_EFFECT] = self._effect + assumed_effect = self._effect for platform_entity in self.group.get_platform_entities(Light.PLATFORM): assert isinstance(platform_entity, Light) - platform_entity._assume_group_state(update_params) + if not platform_entity.available: + continue + + supported_modes = platform_entity._internal_supported_color_modes + effect_list = platform_entity._effect_list + + brightness_supported = ( + is_brightness_supported(supported_modes) + and platform_entity._level_cluster_handler is not None + ) + + # unset "off brightness" and "off with transition" + # if group turned on this light + if state and not platform_entity._state: + platform_entity._off_with_transition = False + platform_entity._off_brightness = None + + # set "off brightness" and "off with transition" + # if group turned off this light, and the light was not already off + # (to not override _off_with_transition) + elif not state and platform_entity._state and brightness_supported: + # use individual brightness, instead of possibly averaged + # brightness from group + platform_entity._off_brightness = platform_entity._brightness + platform_entity._off_with_transition = self._off_with_transition + + # Note: If individual lights have off_with_transition set, but not the + # group, and the group is then turned on without a level, individual lights + # might fall back to brightness level 1. + # Since all lights might need different brightness levels to be turned on, + # we can't use one group call. And making individual calls when turning on + # a ZHA group would cause a lot of traffic. In this case, + # turn_on should either just be called with a level or individual turn_on + # calls can be used. + + # state is always set (turn_on/turn_off) + platform_entity._state = state + + # before assuming a group state attribute, check if the attribute + # was actually set in that call + if assumed_brightness is not None and brightness_supported: + platform_entity._brightness = assumed_brightness + if assumed_color_mode is not None and assumed_color_mode in supported_modes: + platform_entity._color_mode = assumed_color_mode + if ( + assumed_color_temp is not None + and ColorMode.COLOR_TEMP in supported_modes + ): + platform_entity._color_temp = assumed_color_temp + if assumed_xy_color is not None and ColorMode.XY in supported_modes: + platform_entity._xy_color = assumed_xy_color + if ( + assumed_effect is not None + and effect_list + and assumed_effect in effect_list + ): + platform_entity._effect = assumed_effect + + platform_entity.maybe_emit_state_changed_event() def restore_external_state_attributes( self, @@ -1336,6 +1388,7 @@ def restore_external_state_attributes( effect: str | None, ) -> None: """Restore extra state attributes.""" + # Group state is calculated from the members, # except for off_with_transition and off_brightness if off_with_transition is not None: diff --git a/zha/application/platforms/light/const.py b/zha/application/platforms/light/const.py index c39221824..c9c81993e 100644 --- a/zha/application/platforms/light/const.py +++ b/zha/application/platforms/light/const.py @@ -52,8 +52,14 @@ class ColorMode(StrEnum): # If the light should flash, can be FLASH_SHORT or FLASH_LONG. ATTR_FLASH: Final[str] = "flash" -FLASH_SHORT: Final[str] = "short" -FLASH_LONG: Final[str] = "long" + + +class FlashMode(StrEnum): + """Flash modes.""" + + SHORT = "short" + LONG = "long" + # List of possible effects ATTR_EFFECT_LIST: Final[str] = "effect_list" @@ -71,8 +77,8 @@ class ColorMode(StrEnum): EFFECT_DEFAULT_VARIANT: Final[int] = 0x00 FLASH_EFFECTS: Final[dict[str, int]] = { - FLASH_SHORT: Identify.EffectIdentifier.Blink, - FLASH_LONG: Identify.EffectIdentifier.Breathe, + FlashMode.SHORT: Identify.EffectIdentifier.Blink, + FlashMode.LONG: Identify.EffectIdentifier.Breathe, } VALID_COLOR_MODES = {