Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lights JSON broken on recent home assistant #2539

Closed
mcspr opened this issue Sep 24, 2022 · 8 comments
Closed

Lights JSON broken on recent home assistant #2539

mcspr opened this issue Sep 24, 2022 · 8 comments

Comments

@mcspr
Copy link
Collaborator

mcspr commented Sep 24, 2022

Noticed in gitter
https://gitter.im/tinkerman-cat/espurna?at=632e273b9d3c186299170be1

Based on updated docs
https://www.home-assistant.io/integrations/light.mqtt/#json-schema

"white_value" is deprecated and replaced with ["color"]["w"] and ["color"]["c"] combined with "color_mode"

// {
// "brightness": 255,
// "color_temp": 155,
// "color": {
// "r": 255,
// "g": 180,
// "b": 200,
// "x": 0.406,
// "y": 0.301,
// "h": 344.0,
// "s": 29.412
// },
// "effect": "colorloop",
// "state": "ON",
// "transition": 2,
// "white_value": 150
// }

https://www.home-assistant.io/integrations/light.mqtt/#color_mode

Flag that defines if the light supports color modes.

https://www.home-assistant.io/integrations/light.mqtt/#supported_color_modes

A list of color modes supported by the list. This is required if color_mode is True. Possible color modes are onoff, brightness, color_temp, hs, xy, rgb, rgbw, rgbww, white.

@mcspr
Copy link
Collaborator Author

mcspr commented Sep 26, 2022

mcspr added a commit that referenced this issue Oct 23, 2022
see #2539

separate color and white channel availability from settings;
allow color, hs, mired inputs but do not send anything when those are disabled

advertise `color_mode` support, match specific number of channels
with some special mode that should be used on the remote
(which are, currently, shown in separate control tabs)
@mswiss
Copy link

mswiss commented Oct 31, 2022

Hi, are you planning to release a fix for this HA change anytime soon?

@mcspr
Copy link
Collaborator Author

mcspr commented Oct 31, 2022

Fix is in the tree, just pending some testing for the concurrent WebUI changes for the binary

@mattster98
Copy link

mattster98 commented Jan 24, 2023

I noticed this issue on a H801 I have had on 1.14.1 for a long time but only now getting into Home Assistant. I two-step upgraded to the 230112 nightly and it is now being provisioned in HomeAssistant, HOWEVER, it is only showing up as an off/on SWITCH. None of the color or brightness controls are being discovered, even though they are enabled. I have tried various reboot, enable/disable of HASS integration, mqtt json on/off, etc.. but nothing seems to help.

Edit/Update: I found a second entity that appears to be properly configured.. not sure why there are two, but it appears to be sent as both a device: switch with a trailing _0 as well as an entity: light without the trailing _0 . The light has a status of read-only which is preventing me using it in automations, even though when I choose it, I can make changes that appear to work.

@mcspr
Copy link
Collaborator Author

mcspr commented Jan 25, 2023

HA might give some hints in the logger, where it processes MQTT subscription to homeassistant/+
Entity changes between versions were not really avoidable

  • we have switch_0, as you would with physical relay. we have this one set up through relay provider, if you don't want it upload config with "relayProv0": "none" (or, in terminal - set relayProv0 none and reset)
  • lights entity is a brand new one, since HA had breaking changes and it is no longer possible to use some of the old stuff without it completely aborting the setup

@mattster98
Copy link

mattster98 commented Jan 25, 2023

What was the previous relayProv0 value? :) I didn't look before I changed it. It seemed to disable on/off functionality entirely, at least with my current setup.

I think the relay provider attached to the device is coming through the MQTT plugin, and the Light entity is coming via the HASS integration setting on Espurna.

Overnight the Light entity lost its "read only" status on the entity list.. and seems to be staying that way.

I found how to automate entities (I'm still an HA newbie). If it works at all I should be good to go.

@mcspr
Copy link
Collaborator Author

mcspr commented Jan 25, 2023

^ del relayProv0 and reset

from MQTT side of things

1.14.1 did not have this single topic, so we had an extra relay to do state switches. This is no longer the case and lights work differently, but it is kept for backwards compatibility (and for people not using HASS; no need to change topics)

Both switch and light are separate entities when we publish to discovery topic.

@mattster98
Copy link

Thanks! I think what threw me off so much was how straightforward some of the simple relay (even multiple relay) espurnas still on 1.14.1 came into HA, but this one (and the others like it, as I eventually discovered) are quite different.

@mcspr mcspr closed this as completed Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants