Closed shbatm closed 2 years ago
Hi shbatm,
Seems possible. See the modified yaml example: https://github.com/hencou/esphome_components/blob/main/example_milight.yaml
Example of yaml code:
mi:
ce_pin: D0
csn_pin: D8
on_command_received:
- homeassistant.event:
event: esphome.mi_command_received
data:
device_id: !lambda 'return format_hex(data.device_id);'
group_id: !lambda 'return data.group_id;'
remote_type: !lambda 'return data.remote_type.c_str();'
command: !lambda 'return data.command.c_str();'
With the example above, in HA, when you subscibe on the event "esphome.mi_command_received" you will see the incoming events from the ESPHome module.
Tested in my own system -- still working for 6 days without problems.
Awesome, thanks! I didn't see any issues with the code, but I wasn't able to test before I left town. I have a spare Gledopto remote I'll get setup when I get back.
Have a feature request for you--I could probably clobber something together but my C++ is terrible.
Add a
on_code_received
trigger & callback to allow automations for remotes not bound to a bulb, similar to the RFBridge Component:https://esphome.io/api/classesphome_1_1rf__bridge_1_1_r_f_bridge_received_code_trigger.html https://esphome.io/api/classesphome_1_1rf__bridge_1_1_r_f_bridge_component.html#a8d44e0233fe8f3e405563d6ee5dbf849
Reason: this would allow for extra remotes to be used and events sent back to home assistant using ESPHome Automations.
For example (using RF Bridge as a reference):