Home Assistant release (hass --version): latest 0.63.3
Python release (python3 --version): Python 3.5.3
Component/platform: MQTT Light
Description of problem:
HASS ignores the template declared - whatever it's content, HASS always sends 1-255 value.
Expected:
Send value from template or any other defined by configuration.
Problem-relevant configuration.yaml entries and steps to reproduce:
white_value_command_template: "{{ '0000000000' }}"
Sends value from the slider - between 1-255, never the zeroes.
Traceback (if applicable):
Additional info:
I am seeing this same issue.
After quickly looking through the code, I don't think this is implemented at the moment.... I have manually hacked the correct template for my system in components/light/mqtt.py, formatting the device_white_value before the relevant mqtt.async_publish call
Bump. Either can the hack be published @iletunic or this functionality modified?
RGBW light strips aren't that unusual and also is Tasmota... Would be nice to be able to finally control it.
Bump 2 - am I the only one with will to use RGBW with MQTT in HASS? :-)
Bump?
Bump 2 - am I the only one with will to use RGBW with MQTT in HASS? :-)
Nope :-)
Still trying but I haven't time to dig into the code...
Bump once again? My lights are still waiting to be controlled by HASS :-(
@balloob is there any chance of getting that fixed any time soon?
I've contacted robbiet480 on chat, he won't be able to fix it as he added these functions blindly and have other priorities
Currently white_value slider is 'dead' if MQTT device doesn't expect 1-255 values - white_value_command_template is totally ignored by HASS while changing slider value in UI :-/
@Mysteriosis any progress?
Really, this bug is here since february already...
I am also still interested in this. Hope to see some updates soon!
@iletunic why don't push PR then?
@andriej I actually gave up on this one, sorry...
In fact, I had an old version of HASS and when I updated it, it says that all my .yaml declaration were wrong in the rgb strip part. So I commented it and I passed to something else.
Like @iletunic, I think it'll be faster to create a hack for your model, if you have some knowledge in python & electronics (which is not my case)
@Mysteriosis I'm not a fan of leaving bugs behind, especially if the documentation is wrong since beginning.
HASS is developed with tests which should not pass - they did, but still it doesn't mean the bug should be left behind...
It's just I don't know python enough to hack this and make PR. Probably a 5 min for someone who does, still wondering why no one would.
@andriej I was taking a look a look at this and I'm a little confused by your configuration.yaml sample. I don't see an option for a white_value_command_template on the light.mqtt documentation (or the relevant code).
It seems like this functionality should actually be added to the MQTT Template Light and then you would be able to customize the command_on_template.
Edit: After testing this out, it seems like it actually works as expected, there's just a documentation bug. Here's an example config that works:
light:
- platform: mqtt_template
command_topic: "home/rgb1/set"
state_topic: "home/rgb1/status"
command_on_template: "on,{{ brightness|d }},{{ red|d }}-{{ green|d }}-{{ blue|d }}-{{ white_value|d }}"
command_off_template: "off"
state_template: "{{ value.split(',')[0] }}" # must return `on` or `off`
brightness_template: "{{ value.split(',')[1] }}"
red_template: "{{ value.split(',')[2].split('-')[0] }}"
green_template: "{{ value.split(',')[2].split('-')[1] }}"
blue_template: "{{ value.split(',')[2].split('-')[2] }}"
white_value_template: "{{ value.split(',')[2].split('-')[3] }}"
I've opened a pull request to get the documentation updated.
@rohankapoorcom are you joking?
look at the docs for:
rgb_command_template
(string)(Optional)Defines a template to compose message which will be sent to rgb_command_topic. Available variables: red, green and blue.
it should work EXACTLy the same and let user recalculate the value of slider!
not all MQTT light await for 1-255 values, come on
@andriej I'm still not seeing the problem here....
command_on_template: "on,{{ brightness|d }},{{ red|d }}-{{ green|d }}-{{ blue|d }},{{ (white_value | int) / 255}}"
That lets you make a float between 0 and 1 to control your brightness. You should be able to do any of the needed scaling you need to do in the jinja template now shouldn't you?
@andriej stop having this attitude to our developers and stop tagging them. You are really annoying and people are getting pissed off. People do this in their spare time. I am going to close this issue and I hope you can be more respectful in the future or there is no place for you in our community.
Most helpful comment
@andriej stop having this attitude to our developers and stop tagging them. You are really annoying and people are getting pissed off. People do this in their spare time. I am going to close this issue and I hope you can be more respectful in the future or there is no place for you in our community.