Automation's not working after recent update

Good afternoon all,

After the recent updates I’ve had an issue with my automation’s not working i will attach my config and automation for examination, hopefully someone will be able to tell me if/where i have made a mistake.

Thanks in advance for any help/advice.

binary_sensor:    
- platform: mqtt
  state_topic: "tele/RF_Bridge/RESULT"
  name: 'Hallway Motion'
  value_template: '{{ value_json.RfReceived.Data }}'
  payload_on: 'E5D30E'
  payload_off: 'E5D30Eoff'
  device_class: motion
  qos: 1

- platform: mqtt
  name: "Bathroom Door"
  state_topic: "tele/RF_Bridge/RESULT"
  value_template: '{{ value_json.RfReceived.Data }}'
  payload_on: "2C8D0A"
  payload_off: "2C8D0E"
  device_class: Door
  qos: 1  


- alias: light on
  trigger:
  - platform: state
entity_id: binary_sensor.hallway_motion
to: 'on'
for:
  minutes: 5
  condition:
  - condition: or
conditions:
- condition: sun
  after: sunset
- condition: sun
  before: sunrise
  action:
  - service: switch.turn_on
data:
  entity_id: switch.hallway_light
  
- alias: Bathroom door
  trigger:
  - platform: state
entity_id: binary_sensor.bathroom_door
to: 'on'
for:
 minutes: 5
  condition:
  - condition: or
conditions:
- condition: sun
  after: sunset
- condition: sun
  before: sunrise
  action:
  - service: switch.turn_on
data:
  entity_id: switch.bathroom_light

Did you make a mistake copy-pasting the automations or is that the way they are actually formatted in your configuration file? The indenting is all wrong.

it was copied and pasted from before the update, has there been changes to that?

I copy-pasted your two automations into Home Assistant and they failed to pass Config Check.

I don’t know how those two automations ever worked as shown above. It’s not a matter of Home Assistant’s version, they are simply not in valid YAML format.

Here are your two automations in valid YAML format and they pass Config Check.

- alias: light on
  trigger:
  - platform: state
    entity_id: binary_sensor.hallway_motion
    to: 'on'
    for:
      minutes: 5
  condition:
    condition: or
    conditions:
    - condition: sun
      after: sunset
    - condition: sun
      before: sunrise
  action:
    - service: switch.turn_on
      data:
        entity_id: switch.hallway_light
      
- alias: Bathroom door
  trigger:
  - platform: state
    entity_id: binary_sensor.bathroom_door
    to: 'on'
    for:
      minutes: 5
  condition:
    condition: or
    conditions:
    - condition: sun
      after: sunset
    - condition: sun
      before: sunrise
  action:
    - service: switch.turn_on
      data:
        entity_id: switch.bathroom_light

Are you referring to the automation’s or the config?

If you check my two posts, I referred to the automations.

In addition, if the binary_sensors and the automations are all defined within configuration.yaml, as opposed to separate files for binary_sensors and automations, then you must include the automation: domain name before the first line of the first automation. If your automations are held in a separate file then the domain name is excluded from that file.

The automation’s are defined in the automation’s tab in the configurator and like wise with the configuration. What is strange is as mentioned this is copied and pasted from before an update and it all worked perfectly fine. So if possible can you point me in the direction to get it right?

I already have. I posted corrected versions of your two automations (see above).

Many thanks i appreciate your help, can you advice where i had gone wrong?
Was it incorrect spacing or just wrong all together?

Incorrect spacing.

Your automations appear to work like this:
If there’s motion for at least 5 minutes and the time is between sunrise and sunset then turn on a light. If that’s not the behavior you want then you’ll need to change it.

brilliant thank you, whilst i got you can i ask why i keep getting this error message in my log?

No matching payload found for entity: Hallway Motion with state_topic: tele/RF_Bridge/RESULT

I would first need to see the configuration for Hallway Motion. However, my guess is the payload you are receiving via tele/RF_Bridge/RESULT contains something unexpected. The sensor expects to receive whatever you specified in payload_on and payload_off but is receiving something else.

This is majority of my config,

sensor:
  # Weather prediction
  - platform: yr
  - platform: mqtt
    state_topic: 'tele/SW1/SENSOR'
    qos: 1
    name: 'Temperature'
    unit_of_measurement: '°C'
    value_template: '{{ value_json.DHT11.Temperature }}'
    
  - platform: mqtt
    state_topic: 'tele/SW1/SENSOR'
    qos: 1
    name: 'Humidity'
    unit_of_measurement: '%'
    value_template: '{{ value_json.DHT11.Humidity }}'

binary_sensor:    
- platform: mqtt
  state_topic: "tele/RF_Bridge/RESULT"
  name: 'Hallway Motion'
  value_template: '{{ value_json.RfReceived.Data }}'
  payload_on: 'E5D30E'
  payload_off: 'E5D30Eoff'
  device_class: motion
  qos: 1

- platform: mqtt
  name: "Bathroom Door"
  state_topic: "tele/RF_Bridge/RESULT"
  value_template: '{{ value_json.RfReceived.Data }}'
  payload_on: "2C8D0A"
  payload_off: "2C8D0E"
  device_class: Door
  qos: 1  


switch:
  icon: 'mdi:light'
  platform: mqtt
  name: "Light"
  command_topic: "cmnd/SW1/POWER"
  state_topic: "stat/SW1/POWER"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: true

switch landing:
  platform: mqtt
  name: "Landing light"
  command_topic: "cmnd/landing/POWER"
  state_topic: "stat/landing/POWER"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: true

switch hallway:
  platform: mqtt
  name: "hallway light"
  command_topic: "cmnd/hallway/POWER2"
  state_topic: "stat/hallway/POWER2"
  qos: 1
  payload_on: "ON"
  payload_off: "OFF"
  retain: true
  
switch bathroom:
  platform: mqtt
  name: ' bathroom light'
  command_topic: 'cmnd/bathroom/POWER'
  state_topic: 'stat/bathroom/POWER'
  qos: 1 
  payload_on: 'ON'
  payload_off: 'OFF'
  retain: true
  
switch front light:
  platform: mqtt
  name: 'front door'
  command_topic: 'cmnd/frontlight/POWER'
  state_topic: 'stat/frontlight/POWER'
  qos: 1
  payload_on: 'on'
  payload_off: 'off'
  retain: true

You have two sensors subscribed to the same topic, tele/RF_Bridge/RESULT, because that one topic can contain information that is pertinent to either sensor.

Let’s say the tele/RF_Bridge/RESULT contains data that pertains to the Bathroom Door sensor. In other words, value_json.RfReceived.Data contains either 2C8D0A or 2C8D0E. Hallway Motion sensor receives the same data but it, of course, fails to match what it expects to receive ( payload_on: 'E5D30E', payload_off: 'E5D30Eoff'). As a result, Home Assistant reports the mismatch with the WARNING message:
No matching payload found for entity: Hallway Motion with state_topic: tele/RF_Bridge/RESULT

There’s a very long thread discussing this issue here:

The simplest solution is offered in this post. It suggests you suppress all WARNING messages produced by the MQTT component and only allow ERROR messages to be reported.

In configuration.yaml:

logger:
  default: warning
  logs:
    homeassistant.components.mqtt: error

To be clear, this doesn’t fix anything and only hides MQTT’s WARNING messages.

I offer you a proper solution to the problem. It does not rely on suppressing messages but uses an improved value_template to avoid the problem.

  - platform: mqtt
    name: 'Hallway Motion'
    state_topic: 'tele/RF_Bridge/RESULT'
    value_template: >-
      {% if value_json.RfReceived.Data == 'E5D30E' %}
        {{'ON'}}
      {% elif value_json.RfReceived.Data == 'E5D30Eoff' %}
        {{'OFF'}}
      {% else %}
        {{states('binary_sensor.hallway_motion') | upper}}
      {% endif %}
    device_class: motion
    qos: 1

  - platform: mqtt
    name: 'Bathroom Door'
    state_topic: 'tele/RF_Bridge/RESULT'
    value_template: >-
      {% if value_json.RfReceived.Data == '2C8D0A' %}
        {{'ON'}}
      {% elif value_json.RfReceived.Data == '2C8D0E' %}
        {{'OFF'}}
      {% else %}
        {{states('binary_sensor.bathroom_door') | upper}}
      {% endif %}
    device_class: Door
    qos: 1

I tested it on my system and I can toggle the sensor states without causing the “No matching payload” message to appear.

Ive put that into my config but no joy not quite sure what ive done, starting to pull my hair out lol.

I can’t help you unless you provide details. “no joy” only tells me it didn’t work. It may be as simple as the indenting was wrong after you copy-pasted the example.

It wont switch the light via the sensor itself or the state change in hass, im really trying to not be to stupid and solely rely on you to fix this for me just been having this issue for about 6 weeks now.

In order to help you, you have to help me first. You help me by providing detailed information. Without you telling me more about what you are observing, I don’t have enough information to help you.

For example, when things don’t work at all or not as you expected, the first thing to confirm is that your configuration is valid and there are no unusual messages in the log.

  • When you run Config Check does it pass or fail?

  • Are there any new WARNING or ERROR messages in Home Assistant’s log?

I have had the same problem with Automation not working after recent updates.
I narrowed it down to using ‘Sun’ in the Conditions. Try replacing Sun with a specific Time range and see if that works.