Payload type not accepted in configuration.yaml. Error: No matching payload found for entity

I home assistant 0.96.5 Log file I obtain Error: No matching payload found for entity
I tried to config a binary sensor for Aqara DJT11LM vibration sensor but the error persist.
My configuration is:

binary_sensor:

  - platform: mqtt
    state_topic: "zigbee2mqtt/0x00158d0009c3c80e"
    name: "vibrante"
    payload_on: "ON"

Error: No matching payload found for entity: ***** with state_topic: zigbee2mqtt/0x00158d0009c3c80e
Can anyone help me?

The error message is telling you that the payload received via the state_topic is not ON or OFF.

Error: No matching payload found for entity

Your task now is to discover what is being published to zigbee2mqtt/0x00158d0009c3c80e. I suggest you use an MQTT client, like MQTT Explorer, to subscribe to that topic and observe its payloads. It may simply be that they are in lower-case: on and off.

Hello, thanks for your answer.
I checked with mqtt client and obtain this, but I don’t know what I can do

{“linkquality”:68,“angle_x”:1,“angle_y”:-1,“angle_z”:88,“angle_x_absolute”:89,“angle_y_absolute”:91,“battery”:100,“voltage”:3185,“angle”:157}

qos : 0, retain : false, cmd : publish, dup : false, topic : zigbee2mqtt/0x00158d0002c3c80e, messageId : , length : 173, Raw payload : 1233410810511010711311797108105116121345854564434971101031081019512034584944349711010310810195121345845494434971101031081019512234585656443497110103108101951209597981151111081171161013458565744349711010310810195121959798115111108117116101345857494434989711611610111412134584948484434118111108116971031013458514956534434971101031081013458495355125

I try with mqtt explorer and obtain:

"linkquality":113,
"angle_x":1,
"angle_y":-1,
"angle_z":88,
"angle_x_absolute":89,
"angle_y_absolute":91,
"battery":100,
"voltage":3185,
"angle":157,
"action":"vibration"

I do not see state or other element for payload to insert in binary sensor.
Can you help me?

That is not a binary sensor.

The action can be “vibration”, “tilt”, or “fall”.

So you can create a template sensor ( not binary sensor) with the following:

value_template: "{{ value_jason.action }}"

Or I think you can use this in your binary sensor but you will not get the other two states:

value_template: "{{ value_jason.action == 'vibration' }}"

No payload key required.

You could create similar binary sensors for fall and tilt.

Thank you, but NOT WORK.
I used:

binary_sensor:

  - platform: mqtt
    state_topic: "zigbee2mqtt/0x00158d0002c3c80e"
    name: "vibro"
    value_template: "{{ value_jason.action == 'vibration' }}"

ERROR:
No matching payload found for entity: vibro with state_topic: zigbee2mqtt/0x00158d0002c3c80e

Error parsing value: ‘value_jason’ is undefined (value: {“linkquality”:110,“angle_x”:1,“angle_y”:-1,“angle_z”:88,“angle_x_absolute”:89,“angle_y_absolute”:91,“battery”:100,“voltage”:3175,“angle”:157,“action”:“vibration”}, template: {{ value_jason.action == ‘vibration’ }})

for automation can I use this?

- alias: Rileva vibration
  trigger:
    platform: state
    entity_id: binary_sensor.vibro
    to: 'vibration'
  action:
    service: notify.telegram
    data:
      message: Vibrazione

Not for a binary sensor. Their states are either ‘on’ or ‘off’.

If you made a sensor (not a binary sensor) then the state could be vibration, fall or tilt.

What are the possible states for action? Currently it indicates vibration but what other state can it report? If it reports just two states for action then we can configure it as a binary_sensor. otherwise, like Tom explained, it will have to be configured as a sensor.

There’s a typing error in your value_template. It should be value_json.action not value_jason.action.

Thank you so much.
I make this and work very fine but for only one state (vibration). But, if I want notifications for all states?

sensor:
  - platform: mqtt
    state_topic: "zigbee2mqtt/0x00158d0002c3c80e"
    name: "vibro"
    value_template: "{{ value_json.action == 'vibration' }}"

automation

- alias: Rileva vibration
  trigger:
    platform: state
    entity_id: sensor.vibro
    to: 'True'
  action:
    service: notify.telegram
    data:
      message: Vibrazione

Please can you write for me a sensor configuration and automation for all states vibration, fall and tilt?

Change the sensor’s configuration to this:

sensor:
  - platform: mqtt
    state_topic: "zigbee2mqtt/0x00158d0002c3c80e"
    name: "vibro"
    value_template: "{{ value_json.action}}"

Now it will report whatever value is received in action (vibration, fall, or tilt).

Change the automation to trigger when the sensor’s state is vibration.

- alias: Rileva vibration
  trigger:
    platform: state
    entity_id: sensor.vibro
    to: 'vibration'
  action:
    service: notify.telegram
    data:
      message: Vibrazione

Create additional automations to detect when the sensor’s state is fall and tilt.

Alternately, you can create one automation to handle all possible states:

- alias: 'Example1'
  trigger:
    platform: state
    entity_id: sensor.vibro
  action:
    service: notify.telegram
    data_template:
      message: '{{ trigger.to_state.state }}'

The message template is a bit more complicated if you want to translate vibrate, fall, tilt into Italian. Let me know if you want to do this.

Hello Taras, thank you very much for your help.
Yes, if you could help me for the message template, vibrate, tilt, fall in Italian, I would be very grateful

You may need to correct my Italian translations:

- alias: 'Example2'
  trigger:
    platform: state
    entity_id: sensor.vibro
  action:
    service: notify.telegram
    data_template:
      message: >
        {% set actions = {'vibration':'Vibrazione', 'tilt':'Inclinazione', 'fall':'Cadere'} %}
        {{ actions[trigger.to_state.state] if trigger.to_state.state in actions.keys() else 'Incognito'}}
  • The template defined a dictionary, called actions, containing the sensor’s three states (vibration, tilt, and fall) and their respective Italian translations.
  • If the value of trigger.to_state.state is found in the dictionary’s keys then it will display the translated value.
  • If it is not found in the dictionary it displays Incognito.

Thank you very much.
Another question: do you know about hide functions like bed_activity for this sensor and how to create and activate sensor in home assistant?

I don’t understand your question. Do you want to use this sensor to detect if someone is in bed?

If that’s your question, I have no experience with this Aqara device so I don’t know if it’s sufficiently sensitive to detect presence in a bed.

Yes, this is a fantastic device that also handles other hidden functions that can be used in multiple applications.
I ask you because, with your last script (translated), when the action is tilted, it also generates another unknown event that is shown with the word “incognito”, as you expected. This only with a tilt event.

To display the unknown event’s name, temporarily replace 'Incognito' with trigger.to_state.state.

    data_template:
      message: >
        {% set actions = {'vibration':'Vibrazione', 'tilt':'Inclinazione', 'fall':'Cadere'} %}
        {{ actions[trigger.to_state.state] if trigger.to_state.state in actions.keys() else trigger.to_state.state }}

In log have error:

Error while executing automation automation.rileva_vibration. Invalid data for call_service at pos 1: required key not provided @ data[‘message’]

Have you idea?

You will have to post your automation so that I can examine it.

Hello Taras, about error Error while executing automation automation.rileva_vibration. Invalid data for call_service at pos 1: required key not provided @ data[‘message’] this is my automation

- alias: Rileva vibration
  trigger:
    platform: state
    entity_id: sensor.vibro
  action:
    service: notify.telegram
    data_template:
      message: >
        {% set actions = {'vibration':'Vibrazione', 'tilt':'Inclinazione', 'drop':'Caduta'} %}
        {{ actions[trigger.to_state.state] if trigger.to_state.state in actions.keys() else trigger.to_state.state }}

I think that error message is produced if message is blank. This could happen if there is no value for the sensor’s state.

Change the last line to:

        State is ({{ actions[trigger.to_state.state] if trigger.to_state.state in actions.keys() else trigger.to_state.state }})

Now if the state is Caduta the message will appear as:
State is (Caduta)
or if the state is blank, the message will be:
State is ()