Works great and I’ve got some MQTT automations running. However it works kinda crappy. The device pushes MQTT updates. So there’s a topic that says what the device ID (remote) is, and which group (0-4) it controls.
There’s a additional payload that sends the changed subject. For example {“state”:“OFF”} when you turn it off, {“brightness”:100} when you change the brightness (0-255) and a hue payload.
I do have Milights right now, but I’ve got Hue lights that I’ve got that I want to use with the remote. How can I control that? I have the on/off switch working, but RGB and dimming is a little harder. The point is that it’s one of the values in the payload. How can I update the entity with only the payload that I get?
So when I get a state OFF command I want to call light.turn_off, when it’s on turn_on. That’s working now, but the state is not always present. When I get a brightness value I want to set that but not change the state or RGB or whatever.
Is this possible with an automation, or do I need a script? I tried to pass the trigger.payload (normal or json format) to a script, but when I then try to use it in the script the payload is only a string. What can I do to make it work as good as possible? It seems I need 5 automations per remote (one for each group). Any way to make this easier somehow?
For sure! I’ve built two custom components for this. One for HASS that controls any light, and one especially for Hue, which communicates with the Hue Bridge directly, since it has cool features like brightness increase/decrease and kelvin increase/decrease, and the performance is better than via HASS.
It’s not really bullet-proof, and it ‘works’, but it works great once it’s set up correctly.
Do you mean controlling Hue bulbs with MiLight remote?
How did you setup MiLight? As mqtt/mqtt_json/mqtt_template? If using mqtt_json you can try this (can also send RGB, color_temp, etc, just needs the update in the condition). You can template it further by adding wildcards in the mqtt topic (use + instead of 0xAAAA and 1) and setting Hue light name to be extracted from the payload ({{ trigger.topic.split(’/’)[3] }}) so a 4 zone MiLight remote is controlling 4 Hue bulbs. This way, you don’t need 4 automations for each group by templating (below MiLight group 1 is sending its payload to Hue1).
I can’t tested at the moment but I think 3 or 4 automations should cover all the different buttons of the MiLight remote (as I’m unsure all light properties are sent in a single mqtt payload; I recall saturation is separate).
Hi, I know this a 5yr old topic, but would you mind sharing those custom components please?
I’ve successfully built the ESP hub and mqtt has discovered it. Thing is, I bought the remote by accident - I intended to get the zigbee version and use it with Z2M - so, I don’t actually have any MiLight bulbs that I want to pair and control, but I do want to be able to control some Tazmota bulbs and some zigbee LED strip controllers, via HA.
Ultimately I’d like to trigger some automations from button presses - ideally to control a TV volume via an IR blaster, but I’ll just focus on the basics till I get my head round that!
I’m really at a loss how to pass those messages through mqtt (mosquito broker) to other destinations.