-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Status topic of dimmer command #1360
Comments
This is the result of a long discussion about multiple replies after doing a power on, changing color or dimmer values. The result of these commands always lead to multiple changes like changing dimmer will also change color value and might change power if it was on or off. |
Why not have have a
As commands take a single value, RESULT would provide a result to that particular command only, making it consistent with rest of the command set. However, each change would also generate a message to another topic that can be retained and saves a value of overall light object:
Would that make sense? |
So, I got it working with the PR I submitted and following Home Assistant configuration:
To get on/off status, you can also use:
Matter of taste, I guess ;) |
I was looking at this and to me it would make more sense for the RESULT to show the other status its updated, so for instance a change to DIMMER, POWER, COLOUR or CT would always return this: stat/sonoff/RESULT = {"POWER":"ON", "Dimmer":56, "Color":"1A0B048E", "CT":"500"} I have made this change, and implemented it in such a way that any driver interface can pass a full set of data to the RESULT for a POWER command, so it extensible in the future if other drivers want to do the same. Happy to submit a PR for @arendst to merge, or I can make some changes to it if this is not liked. My copy is at https://github.com/bensuffolk/Sonoff-Tasmota. BTW I only came across this after my implementation, and I saw nothing about LIGHT command in the wiki. Regards Ben |
I'm looking at hass these days and I donlt know why people have that many problems with it... I've currently the mqtt discovery running for switch and light with functional dimmer and no additional light fix. Just make sure tasmota always replies with RESULT (setoption4 0) and let hass check json responses. Main problem with discovery is the enormous amount of mqtt data to send resulting in almost 2k ram loss only to send an initiall discovery message. Ram loss will be fatal over time. Currently in testing. |
I admit to only just installing HASS last week, so don't pretend to know loads about it, but did notice that when you use a template to read the brightness values in from a state, because the POWER sends back on the same topic and does not include the brightness there is an error in parsing the template. Thats why I thought it would be a good idea to make sure all states could be updated via a single MQTT payload when something changes. After all they are all interlinked. So if you change a CT it affects the COLOUR, if you change COLOUR it can affect both DIMMER and CT. So it good for HASS (or whatever you use) to know the correct state of all the attributes of the light. EDIT: Just looked at the MQTT Discovery in HASS, and I see you would have to send quiet a lot in the payload to set it up because of all the settings that need overriding for the topic states etc. I can see discovery being quiet nice for some users long term to have a plug and play type device, but it would not feature on my must have list. |
I've extended the color information with the CT value as it was missing and noted by @bensuffolk. I've also redesigned the MQTT message size problem by allowing up to almost 900 characters in a message enough for Hass discovery to notice something ;-). For Hass I had to make some changes to the color command too (needs decimals values which were there but not advertised as it's a bit tricky). These are the current discovery messages: For a two color cold/warm led:
For a RGB led:
I'll release the (experimental) Hass driver soon. It's experimental as Hass keeps on logging error messages regarding color values which I currently cannot explain. |
Some of those commands like payload_off etc are optional and tasmota uses the defaults so if you needed to save some space in the message / code you could miss them out. |
@arendst , in both discovery messages you mention : I am a total noob at this, so chances are that i'm mistaken 😸 |
Hi everyone, I know this is an old issue, but I lost of track of how it ended up being resolved. I have a number of flashed sonoff bulbs that I can turn on and off in hass, but I'm trying to figure out how to interface with the brightness level. When I change the brightness on the bulb's web interface, the console just produces a RESULT line with all of the attributes listed. This seems to be what was being discussed above. Is there a solution? Thanks in advance. |
It would make sense to create a separate status topic for a Dimmer/Color command.
Currently, this is what happens:
but in Dimmer case, we only get back a generic result of a command containing all the necessary details.
Apart from being inconsistent, it creates problems for parsing, as some platforms (Home Assistant) don't have conditional parsing (if topic content is in format XYZ, than consider it as status change for light object ABC), or at least I haven't been able to make it work. Best I could do is to force Home Assistant to parse every RESULT, which leads to a lot of error messages in the logfile, as most of the RESULTs don't have Dimmer and Color fields.
Additional problem is that RESULT can't be retained, which means that every restart/failover looses a last known state (RESULTs shouldn't be retained with a good reason, btw, but we need another indication of status).
I can provide a patch for Dimmer/Color only, but am wondering if there are other cases that I'm personally not using, that have similar inconsistency problem?
@arendst - what's your take?
The text was updated successfully, but these errors were encountered: