hugobloem / stateful_scenes

Stateful Scenes in Home Assistant (Home Kit scene compatible)
MIT License
53 stars 7 forks source link

Attributes to add to light #25

Open vsmith80 opened 1 year ago

vsmith80 commented 1 year ago

Well, the feature to remember previos state is pretty cool! I have one complicated automatization to make light switch to previos state when i'm pressing the switch. And i tried to check new feature I have scene "Kitchen duty light", "Kitchen usual light" and "Kitchen no light". When duty light is truned on pressing the switch makes usual light active, and the next press to switch makes active prevous scene.

So i'm truning on "Restore on deactivate" on switch of scene "Kitchen usual light" And the light not turning back to last state exactly.

When "Kithen duty light" is activated my lamp looks like that:

=============Duty light

color_mode: color_temp
brightness: 13
color_temp_kelvin: 2000
color_temp: 500
hs_color:
  - 30.601
  - 94.547
rgb_color:
  - 255
  - 136
  - 13
xy_color:
  - 0.599
  - 0.382
raw_state: true
icon: mdi:wall-sconce-flat
friendly_name: Kitchen lamp
supported_features: 23

Activating the usual light scene turns it to that:

============ Usual light

color_mode: color_temp
brightness: 255
color_temp_kelvin: 2433
color_temp: 411
hs_color:
  - 29.057
  - 75.004
rgb_color:
  - 255
  - 156
  - 63
xy_color:
  - 0.554
  - 0.389
raw_state: true
icon: mdi:wall-sconce-flat
friendly_name: Kitchen lamp
supported_features: 23

Deactivating the usual light switch makes it not to first state, but to that

color_mode: hs
brightness: 255
hs_color:
  - 30
  - 94.9
rgb_color:
  - 255
  - 134
  - 13
xy_color:
  - 0.602
  - 0.38
raw_state: true
icon: mdi:wall-sconce-flat
friendly_name: Kitchen lamp
supported_features: 23

As far i can see somehow color_mode attribute is changing, and hs state of that attribute have no brightness, color_temp_kelvin and color_temp

So' maybe it's possible to save color_mode attribute?

hugobloem commented 1 year ago

Hi,

I also noticed that the integration doesn't always restore to the expected state of the lights. I suspect this might be due to transitions being saved as states to which the entity is restored.

I don't think the colour mode is influencing anything here. Colour mode simply tells us what mode is used to set the colour of a light. Since this integration only sets lights according to their RGB value this shouldn't change anything.

I will look into this and see what I can do.