resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

No +/- in TYPES.LIGHT #743

Closed Quarco closed 3 years ago

Quarco commented 3 years ago

I use last versions of TileBoard with Home Assitant and zWaveJS. But I cannot control the light intensity because the + and - are not shown into the tile.

HUE lights (still) get these controls, but somehow I don't get it with my zwave devices. Anyone else having this problem? Or is it a bug?

(Screenshot are both dimmers, Hal = Hue, Keuken = zwave)

image

atleso commented 3 years ago

I'm missing the +/- for my knx lights as well. I have no other lights so nothing to compare with. Happened after upgrading HA.

rchl commented 3 years ago

Can you open /developer-tools/state and screenshot the relevant entity (including the attributes)?

Quarco commented 3 years ago

image image

rchl commented 3 years ago

And how does your tileboard entity configuration looks like for the tile that is missing the +/- buttons?

Quarco commented 3 years ago

image

atleso commented 3 years ago

HA state attributes:

min_mireds: 166
max_mireds: 370
supported_color_modes:
  - color_temp
color_mode: color_temp
brightness: 90
color_temp: 290
friendly_name: Bedroom 4 (Office) ceiling lights
supported_features: 0

Relevant tile config:

{
               title: 'Bedroom 4 (Office)',
               width: 1,
               height: 3,
               items: [
                  {
                     position: [0, 0],
                     width: 1,
                     type: TYPES.LIGHT,
                     title: 'Ceiling lights',
                     id: 'light.bedroom_4_office_ceiling_lights',
                     states: { off: 'Off',  on: 'NA' },
                     icons: {
                        on: "mdi-lightbulb-on",
                        off: "mdi-lightbulb",
                     },
                     state: function (item, entity) {
                        if (Math.round(entity.attributes.brightness / 2.55)) {
                           return Math.round(entity.attributes.brightness / 2.55) + " %"
                        } else {
                           return "Off"
                        }
                     },
                     sliders: [
                        {
                           title: 'Brightness',
                           field: 'brightness',
                           max: 255,
                           min: 0,
                           step: 5,
                           request: {
                              type: "call_service",
                              domain: "light",
                              service: "turn_on",
                              field: "brightness"
                           }
                        },
                        {
                           title: 'Color temp',
                           field: 'color_temp',
                           max: 370,
                           min: 166,
                           step: 5,
                           request: {
                              type: "call_service",
                              domain: "light",
                              service: "turn_on",
                              field: "color_temp"
                           },
                        }
                     ]
                  },

               ]
            },
rchl commented 3 years ago

Looks like we need to change how we check whether the light supports brightness changes since the SUPPORT_BRIGHTNESS flag was deprecated in favor of "color mode".

https://github.com/home-assistant/core/blob/1019ee22ff13e5f542e868179d791e6a0d87369a/homeassistant/components/light/__init__.py#L41-L64

@atleso in your case the light doesn't seem to advertise support for brightness change, only color temperature change. Even if it has the brightness attribute... Does it work in native HA UI to change the brightness? EDIT: No, nevermind, the logic is a bit more complicated and assumes brightness control to be supported in most cases - https://github.com/home-assistant/core/blob/10bfc783651a49ffbe2e7ad8d3e5d5e3223b3180/homeassistant/components/light/__init__.py#L101-L105

atleso commented 3 years ago

Yes, it works in the native UI, and it also works in Tileboard if I long-press the tile.

image

Quarco commented 3 years ago

Great Thanks for looking into this / patch for upcoming release! 👍 @rchl