diff --git a/tests/data/devices/adurosmart-eria-ad-rgbw3001.json b/tests/data/devices/adurosmart-eria-ad-rgbw3001.json index 81248a903..eec51f2ae 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 d150ff68c..12fd53040 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 5a6138952..13f99e287 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 b37d79ae4..2bff4ef67 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 4984dd726..f756950c9 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 e205498ab..44823a628 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 e05a34c48..67c0342d8 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 548f82964..0bc154281 100644 --- a/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json +++ b/tests/data/devices/ecodim-bv-eco-dim-05-zigbee.json @@ -400,6 +400,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", @@ -481,6 +481,7 @@ }, "state": { "class_name": "Light", + "available": true, "on": false, "brightness": 254, "xy_color": null, @@ -496,8 +497,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 201206479..065055489 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 0e9f0b4d7..671773d1f 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 f7a527484..e6de6a067 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 4bb2118a0..14296984f 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 2cd899731..75ffed14f 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 86726435f..8e5700572 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 50f80a8c1..987d2b00c 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 779101203..e3d2bcfa0 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 c105d60fb..c144eeff4 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 4a386553b..a7c8155ce 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 06e2aa137..33e1e3dbc 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 0516641c8..6d79e3717 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 af8719122..dc478ff67 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 c63bd0646..03c133a98 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 81c2c1b73..a03be5daf 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 2773e0def..cb19bd65e 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 2d6ec1b0c..91fc567ac 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 36ff7b13a..a61b9169c 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 ffc11c4b1..b24dd0698 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 75edb5b5d..c5b5c130f 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 18fa6f0e4..4f9b544a5 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 832aec24f..573aa8ea5 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 163d9dc5c..2e56f8fcf 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 6e1a7d62d..d912b1214 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 8c958eaff..675976afa 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 21d3ead27..e37b9c360 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 9226fd17a..b204ad63b 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 0f4288d82..e177d60b5 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 ab4cec1a5..2d5a230f8 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 2a1dbf3cb..7e835ef9a 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 21c30edf1..080cefd06 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 766f4e71f..6babca40d 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 99fed870c..c23c3a145 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 e2afbcd7a..cf97de704 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 1325867ec..c2ac1faec 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 99e450279..f00ba892b 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 88750c13e..380f27b16 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 dad3f9dee..1c18b5492 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 eb4927eb2..6c705d799 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 033816c3b..f27f44995 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 487e82dfa..6b6bc00f6 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 02eb19e8d..cbb8b39cf 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 5d122a002..5467462cd 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 d0fa25362..fa8d13a6d 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 bef693964..b35dc3a95 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 5ae8c5e55..edf201373 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 25aa3fb00..75271664d 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 fa1c9175a..e90a0f7ec 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 c0a2e0720..eadffd884 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 9135953fc..6dab36c2f 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 4862bbffb..d525a7954 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 6a475d36b..8f0792997 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 1b8deadf9..082e0db4f 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 2532a29a7..983524192 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 8aa6bc57b..e11d4b738 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 a5210e0d9..9832c04b6 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 fa88f31f3..0f9b08f56 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 8a7d506fe..7148b56d7 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 40c12cde3..01581b986 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 4aea51e20..2653b576a 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 d28d80d98..320d262c5 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 508f90874..128048883 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 831aa81e6..34de6612b 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 013cd62b0..d6611f95f 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 da8668b2f..e6c0b7bdf 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 c197f5782..5688ba363 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 aed3815ef..98c4a33b0 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 ffd41839b..bedf8bf21 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 4387844fc..ac2afb25d 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 eb1984ed0..d25c67332 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 093fc796f..e3915dcd7 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 f8add74a1..8a633338b 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 7c455fc50..216ca6ead 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 9cf0e23cf..ebdb6080f 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 ed355216e..c07508059 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 6f164002d..a41d13260 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 73477f2c7..dd9654a51 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 7710fcd11..65ccdc574 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 12cb2f23a..a6aa7ece8 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 0f1a6ba3b..68f76d5e9 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 15934b6d1..ed00acd11 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 8338aca49..13bbacd57 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 6afb5bbfe..d33f8c0c9 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 d7be3a9d6..b5311c117 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 82c4974a5..c28c23e68 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 dd198f4d7..4150d46ce 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 ef4bdf2c1..85f89f758 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 6929b8559..242a0a373 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 c1ad4af29..fff3d3b55 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 = {