I’d like to use an esp32 device to turn on a light controlled by a Meross Web Based control. I can turn the light on and off using the Home Assistant UI but I’m not sure how I use yaml in the esp32 to accomplish the same thing. I can get sensor data from the HomeAssistant platform and read data from other entities but I don’t know how to set this up for a switch since 'Switch" , unlike “Sensor” doesn’t exist for Home Assistant. The entity ID is “switch.bedroom_two_lamp_mss110_main_channel_2”.
Is this even possible? All I can find references to are local GPIO switches.
Thanks
Have a read of the homeassitant.service:
action, there are examples in there that should help.
I just got stuck on exactly this type of thing when trying to ‘click’ on an icon for a mushroom template card
you can’t call a switch direct
but you can call a service to do an action to a switch!
tap_action:
action: call-service
service: switch.toggle
target:
entity_id: switch.0xa4c1388e86dfd2fd
This is from HA, not ESPhome. Specifically this only works from the Mushroom card add-on.
Thanks to both you guys. After a couple of false starts I got it running with this yaml:
on_click: then: - lambda: |- id(pagenum) = 2; - display.page.show: page2 - switch.turn_on: backlight - homeassistant.service: service: switch.turn_off data: entity_id: switch.bedroom_two_lamp_mss110_main_channel_2
I wanted to do it all in ESPHome, so thanks again
It’s great to have the resources available on this forum. Thanks again