home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
4.03k stars 2.75k forks source link

State color wrong for dimmable lights #5313

Closed ochstobi closed 4 years ago

ochstobi commented 4 years ago

Checklist

The problem

When an light is dimmed, the bulb icon is getting darker. When turned off while dimmed the icon is darker than normal. SmartSelect_20200322-160532_Home Assistant

Expected behavior

The icon should have the right color (like the others).

Steps to reproduce

Add a dimmable light. Dimm it down to 5-10% and then turn it off.

Environment

Home Assistant v0.107.5. The issue is on mobile phones (ios/android) and with every browser.

Problem-relevant configuration

Should not be configuration relevant.

Javascript errors shown in your browser console/inspector

None.

Additional information

iantrich commented 4 years ago

Please check Developer Tools > States? Is brightness still an attribute when off?

If so that would be an integration issue believe as that should be reported when off, to my knowledge. What light integration are you using?

ochstobi commented 4 years ago

I have a MQTT integration for a zigbee device. In fact the brightness is still an attribute when turned off. I think it is to retain the brightness so it is in the same dimmed state when turned on again.

==Turned on at full brightness== brightness: 255 linkquality: 0 state: 'ON' friendly_name: Licht Wohnzimmer (dimmbar) supported_features: 41

==Turned off while full brightness brightness: 255 linkquality: 0 state: 'OFF' friendly_name: Licht Wohnzimmer (dimmbar) supported_features: 41

==Turned on while dimmed brightness: 43 linkquality: 0 state: 'ON' friendly_name: Licht Wohnzimmer (dimmbar) supported_features: 41

==Turned off while dimmed== brightness: 43 linkquality: 0 state: 'OFF' friendly_name: Licht Wohnzimmer (dimmbar) supported_features: 41

iantrich commented 4 years ago

Well there's our answer then. Wonder if there are any others doing this

iantrich commented 4 years ago

So right here https://github.com/home-assistant/frontend/blob/dev/src/components/entity/state-badge.ts#L87 we should add a check that stateObj.state === 'on'

ochstobi commented 4 years ago

I could not imagine that everyone else is setting the brightness to 255 before simply turning the light off. Simple case is you dimm the light in home assistant and later on you tap the physical switch which turns your light off.

Shouldn't there be a fix color when turned off instead of going darker from brightness - x?

iantrich commented 4 years ago

@ochstobi most integrations do not provide brightness when they are 'off', but the fix is just what I posted earlier and fairly simple