433toMQTT automation

Hi,

I am a new user to hass. I upgraded from pimatic to hass because pimatic constantly stopped receiving rf433 signals and cron no longer worked.

so, my setup is a rpi 2b with hass on it and a esp8266 with rf433 transmitter and reiceiver.

after 3 days of searching the internet and neglecting my wife and kids :stuck_out_tongue: i have it partly running.

in hass i created a switch that does send a code to the esp8266 via mqtt to toggle my kaku light switch.

mosquitto_pub -h 0.0.0.0 -u Admin -P Admin1234 -t home/OpenMQTTGateway/commands/MQTTto433 -m 16405

i also can receive rf433 signals, this i can see on the serial monitor of arduino ide and in the terminal via ssh. The ssh message i receive is:

home/OpenMQTTGateway/433toMQTT {“value”:16404,“protocol”:1,“length”:24,“delay”:363}

now i am trying to automate that when i push te button of my rf remote of the alarm, it kills all lights in the house, the code i have so far is:

alias: test 1
trigger:
platform: mqtt
topic: ‘home/OpenMQTTGateway/433toMQTT’
payload: ‘3031080’
action:
service: mqtt.publish
data_template:
topic: ‘home/OpenMQTTGateway/commands/MQTTto433’
payload: ‘16405’

but it does not work, i tried with and without quotes, with and without commands folder but all without result.

please help

After some more trial and error i finaly got it working! i also got multiple conditions and pushbullet notifications working :muscle:

configuration.yaml

#switches
switch:
- platform: mqtt
  name: kaku_a2
  state_topic: "home/OpenMQTTGateway/commands/MQTTto433"
  command_topic: "home/OpenMQTTGateway/commands/MQTTto433"
  payload_on: "16405"
  payload_off: "16404"
  qos: "0"
  retain: true

#pushbullet
notify:
- platform: pushbullet
  name: hassio
  api_key: <api_key>

automations.yaml

- id: "0001"
  alias: ab_home
  initial_state: on
  trigger:
  - platform: mqtt
    topic: "home/OpenMQTTGateway/433toMQTT"
  condition:
    - condition: template
      value_template: "{{ '3031076' in trigger.payload }}"
  action:
  - service: switch.toggle
    entity_id: switch.kaku_a2
  - service: notify.hassio
    data:
      title: "ab_home"
      message: "kaku_a2 gewijzigd"
1 Like