hass-circadian_lighting icon indicating copy to clipboard operation
hass-circadian_lighting copied to clipboard

feature request: HS support

Open Mearman opened this issue 3 years ago • 7 comments

I have this TuYa LED strip that works by Hue, Saturation, Brightness. Would it be possible for you to add support? I would submit a PR for it, but I wasn't able to find the correct conversion function.

More information here: https://www.zigbee2mqtt.io/devices/TYZS1L.html

supported_color_modes:
  - hs
color_mode: hs
brightness: 70
hs_color:
  - 120
  - 50

Mearman avatar Jun 18 '21 20:06 Mearman

Have you tried using the LED strip with one of the modes supported by Circadian Lighting? Even if the supported_color_modes is listed as hs you should be able to do manual service calls sending rgb_color, hs_color, xy_color, etc and Home Assistant should handle the conversion to whatever "language" the light itself "speaks" - the same should be true for Circadian Lighting.

claytonjn avatar Jun 21 '21 21:06 claytonjn

I've manually called the light_on service with RGB and HS, which both work fine.

I've tried all the Circadian Lighting modes with no success :/

Mearman avatar Jun 22 '21 12:06 Mearman

I've manually called the light_on service with RGB and HS, which both work fine.

Did you try with the light configured under lights_rgb? All CL does is call the same service, so there must be something else causing it to not work. Have you tried looking at the logs, with debug logging enabled for Circadian Lighting?

claytonjn avatar Jun 22 '21 13:06 claytonjn

Ok. The light is being controlled, but is stuck on a blueish white.

What am I looking for in the logs? I'll just grep it out into a new file.

Mearman avatar Jun 23 '21 10:06 Mearman

If controlling the light is working then you should be able to just grep for circadian_lighting

claytonjn avatar Jun 24 '21 17:06 claytonjn

finally got around to pulling the log

"2021-06-24 20":"31":46 DEBUG (MainThread)[
   "homeassistant.components.websocket_api.http.connection"
][
   140096649459936
]"Sending"{
   "id":2,
   "type":"event",
   "event":{
      "event_type":"state_changed",
      "data":{
         "entity_id":"switch.circadian_lighting_circadian_mirror",
         "old_state":{
            "entity_id":"switch.circadian_lighting_circadian_mirror",
            "state":"off",
            "attributes":{
               "hs_color":null,
               "brightness":null,
               "friendly_name":"Circadian Mirror",
               "icon":"mdi:theme-light-dark"
            },
            "last_changed":"2021-06-24T19:31:45.013483+00:00",
            "last_updated":"2021-06-24T19:31:45.013483+00:00",
            "context":{
               "id":"3f7f71a23cf3c9da5f3336f3f1c8b073",
               "parent_id":null,
               "user_id":"f63450270eb741f4a4216df70691b313"
            }
         },
         "new_state":{
            "entity_id":"switch.circadian_lighting_circadian_mirror",
            "state":"on",
            "attributes":{
               "hs_color":[
                  26.777,
                  47.451
               ],
               "brightness":100,
               "friendly_name":"Circadian Mirror",
               "icon":"mdi:theme-light-dark"
            },
            "last_changed":"2021-06-24T19:31:46.499136+00:00",
            "last_updated":"2021-06-24T19:31:46.499136+00:00",
            "context":{
               "id":"f216052270baf7351a9c585145b84ded",
               "parent_id":null,
               "user_id":"f63450270eb741f4a4216df70691b313"
            }
         }
      },
      "origin":"LOCAL",
      "time_fired":"2021-06-24T19:31:46.499136+00:00",
      "context":{
         "id":"f216052270baf7351a9c585145b84ded",
         "parent_id":null,
         "user_id":"f63450270eb741f4a4216df70691b313"
      }
   }
}

Mearman avatar Jun 24 '21 19:06 Mearman

There should be more logged than that, that looks like just the output of the state change that triggered CL to activate but not the actions that CL actually took. Maybe it's best to start by grepping sensor.circadian_values

claytonjn avatar Jun 24 '21 19:06 claytonjn