For a tunable white bulb, is it possible to send kelvin values instead of mired values to a MQTT server? I have my HASS connected to SmartThings and SmartThings will only accept kelvin values for the bulb color?
On the same subject, is it possible to send the Saturation vaules for a RGBW bulb? That appears to be how SmartThings is handling my color bulbs.
If you’re sending those values to SmartThings over the MQTT bridge, you may be out of luck. I’ve been watching another thread on here for quite some time, and so far it doesn’t appear that the MQTT light component will work with HSL color or Kelvin temp. Much of the problem lies with not being able to set separate value templates for the incoming and outgoing values, or publish multiple mqtt packets to specify hue saturation and luminance separately the way SmartThings wants.
Is it possible to accomplish this using an automation with MQTT templates? It seems like it should be, but I don’t understand JSON enough to make it work.
It seems like i should be able to take to mired command and send it to smartthings/light_name/miredcolorTemperature, get that data in an automation, perform math on it, and publish it to smartthings/light_name/colorTemperature.
Hey folks - I figured out a reasonably easy way to accomplish Mired to Kelvin conversions for inbound and outbound color temperature values with the MQTT Light component.
By using this custom component you don’t interfere with the operations of any of the other core python scripts - and it’ll persist updates. The only two lines which were changed are the lines concerning the acquisition of the color temperature payload value from MQTT and the outgoing value script for color temperature.
Color value templating still works as needed, but is unnecessary for the purposes of this component - your MQTT payload is assumed to be kelvin, and the milred value HA generates will be converted to Kelvin before it goes to MQTT.
I’ll check it into github when I get the chance, but you’ll just need to create the directory structure ‘/custom_components/light/’ within your HA config directory - and update your kelvin-using MQTT lights to “platform: mqtt_light_kelvin”
Is it possible to get this updated for 0.84.5? It appears that something changed as others are reporting similar issues with other custom components. Here is the error I’m getting:
2018-12-20 22:06:42 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.light.mqtt_light_kelvin. Make sure all dependencies are installed
Traceback (most recent call last):
File "/usr/src/app/homeassistant/loader.py", line 92, in get_component
module = importlib.import_module(path)
File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/config/custom_components/light/mqtt_light_kelvin.py", line 27, in <module>
from homeassistant.helpers.restore_state import async_get_last_state
ImportError: cannot import name 'async_get_last_state'
2018-12-20 22:06:42 ERROR (MainThread) [homeassistant.loader] Unable to find component light.mqtt_light_kelvin
Here’s a couple other posts showing similar errors:
I tried changing the ‘async_get_last_state’ to ‘RestoreEntity’ on my own, however I got errors about line 229 saying async_get_last_state was not defined. So there’s something else that needs to be done, but I’m not proficient in Python at all so I’d have no idea where to start.