Skip to content

HomeAssistant

Fredrick Bäcker edited this page Nov 9, 2020 · 1 revision

Requirements

To control the devices we need MQTT broker and MQTT client from Home Assistant.

Create a local.json configuration file in broadlink-mqtt-bridge and connect to to broker.

MQTT from Home Assistant

Example Automation, having a boolean switch to turn on/off a nexa switch.

- alias: NexaOutdoor1
  trigger:
    - platform: state
      entity_id: input_boolean.nexa_switch_outdoor1
  action:
    - service: mqtt.publish
      data:
        topic: broadlink/nexa/tmt-918/button1
        payload: "{{ trigger.to_state.state }}"

More advanced example for ac with different modes 'heat, fan, cool' and temperature

- alias: AC Mode
  trigger:
    - platform: state
      entity_id: input_select.livingroom_ac_mode
  action:
    - service: mqtt.publish
      data:
        topic: broadlink/heater/livingroom/mode
        payload: "{{ trigger.to_state.state }}"

- alias: AC Temperature
  trigger:
    - platform: state
      entity_id: input_number.livingroom_ac_temperature
  action:
    - service: mqtt.publish
      data:
        topic: broadlink/heater/livingroom/temperature
        payload: "{{ trigger.to_state.state | int }}"
Clone this wiki locally