MQTT automation broke

At some point in the HA upgrade 0.7x -> 0.86.1 procession my mqtt push-button stopped working. this used to work

  • id: ‘1239458373’
    alias: Remote Toggle
    trigger:
    • payload: ‘16672966’
      platform: mqtt
      topic: home/OpenMQTTGateway/433toMQTT
      action:
    • data:
      entity_id:
      • light.h801_1
        service: homeassistant.toggle

I’d press the digoo 433mhz button, openmqttgateway would publish the switch press value and HA would toggle my home lights; now it doesn’t work. What syntax change did I miss during the HA upgrades? Intent: i just want a push button on my nightstand to toggle the house lights when I go to bed (or get up).

If you go to the dev-states page you might find that the state of the automation is off. It needs to be on to trigger.

thanks for that though. it’s enabled. In fact I can manually trigger it and see the lights toggle state.

I can remover the payload: ‘16672966’ line and watch random (car tire pressure sensors) 433mhz messages toggle the lights also. So it’s the payload syntax that has changed since version 0.73ish.

Can you format the automation because the indentation is completely wrong as presented.

- id: '1239458373'
  alias: Remote Toggle
  trigger:
  - payload: 'value_template: ''{{ value_json.value== "16672966"  }}'''
    platform: mqtt
    topic: home/OpenMQTTGateway/433toMQTT
  action:
  - data:
      entity_id:
      - light.h801_1
    service: homeassistant.toggle

this is where i’m currently at. i’m using the built in automation editor and then extracting that file for pasting from the automations.yaml file.

Is the message received from OpenMQTTGateway in JSON format or not?

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

is what i get from mosquitto_sub -h 192.168.1.35 -v -t “#”

Try this:

- id: '1239458373'
  alias: Remote Toggle
  trigger:
    platform: mqtt
    topic: home/OpenMQTTGateway/433toMQTT
  condition:
    condition: template
    value_template: '{{ trigger.payload_json.value == "16672966" }}'
  action:
    service: homeassistant.toggle
    entity_id: light.h801_1

There’s a similar example here.

this worked (had to remove the quotes around the 16672966)

- id: '1239458373'
  alias: Remote Toggle
  trigger:
    platform: mqtt
    topic: home/OpenMQTTGateway/433toMQTT
  condition:
    condition: template
    value_template: '{{ trigger.payload_json.value == 16672966 }}'
  action:
    service: homeassistant.toggle
    entity_id: light.h801_1

Thank you very much.

Hello @vv_rockhound,

Would it be possible to update OMG wiki to avoid other users your issue :
https://github.com/1technophile/OpenMQTTGateway/wiki/Home-Assistant-manual-integration

Yup, I missed that one (it’s int not string) and used the template you provided (which treated the payload as string). I should’ve paid closer attention to the payload sample you had provided and not your template.

Anyway, glad to hear the revised configuration worked for you.