Hi,
I have a Sonoff RF Bridge and a couple of simple RF devices. Could somebody help a beginner with creating automations based on the “Data:xxx” part of the payload? Preferably in the visual editor.
I created the automation for the topic, I’m just failing to figure out how to filter based on the different payloads.
Many thanks
123
(Taras)
March 12, 2023, 2:07pm
2
Post the automation you created (in YAML format ).
If your automation is using an MQTT Trigger , then in all likelihood, you will need to use a template like this:
{{ trigger.payload_json.RfReceived.Data }}
jatropa33
(Jatropa)
March 13, 2023, 11:35am
3
Hi Taras,
I don’t really have an automation yet. I have a simple sonoff RF door sensor, it sends the following when opened:
MQT: tele/tasmota_01E1D2/RESULT = {“Time”:“2023-03-13T12:18:02”,“RfReceived”:{“Sync”:8000,“Low”:200,“High”:710,“Data”:“EAC701”,“RfKey”:“None”}}
I would like to use this as trigger for automations. “IF message containing “EAC701” received, THEN do x”
I hoped that it would be possible to use wildcards in the payload field like EAC701 but that doesn’t seem to work.
Many thanks
123
(Taras)
March 13, 2023, 1:25pm
4
trigger:
- platform: mqtt
topic: "tele/tasmota_01E1D2/RESULT"
payload: "EAC701"
value_template: "{{ value_json.RfReceived.Data }}"
Reference: MQTT Trigger
1 Like
Thanks it’s working!
It’s a pity that it can’t be done in the visual editor.
1 Like
Hi, sorry to bring up an old topic. I have a similar issue, I’ve tried the solution here but get no response.
MQTT String: 20;21;EV1527;ID=0daed6;SWITCH=09;CMD=ON;
The first two segments (20;21;) change with every transmission recieved.
I have a Button helper I want pushed when ever this device (I have multiple and want to be able to tell them apart) sends a pulse.
The “ID=0daed6” is unique to each so I’m trying to respond to that segment of the string response.
id: ‘1699695316161’
alias: Motion sensor 1
description: ‘’
trigger:
platform: mqtt
topic: /ESP00/msg
payload: “ID=0daed6”
value_template: “{{ value_json.RfReceived.Data }}”
condition:
action:
service: button.press
data: {}
target:
entity_id: input_boolean.motion_detected
mode: single
I’ve tried putting the topic in quotes, using different bits of the recieved payload and doing a full reboot after each change to no avail.
I’m open to any suggestions.
Thanks
Manged to split the string into segments using this example:
Hi,
I’m new to home assistant (I want to switch from openhab to home assistant) and I have a first question.
What is the best way to split a MQTT payload in pieces and use/send this “pieces” as a state to different entities?
At this moment I configured a (MQTT) sensor that receives a string like this: “*STR,3,30,50,50,50,2,1;” . Now I want to use/send these different values as a state to different entities.
I’m able to split the string into pieces by using the “template” functionality of hom…
Which gives me subtopics that I can monitor for the specific device. Not everything reports properly but I get out what I need so I’m happy.
My current code:
alias: RFLINK32 String Split
description: ‘’
trigger:
platform: mqtt
topic: /ESP00/msg
action:
variables:
data: ‘{{ trigger.payload[5:-1].split(’‘;’‘) }}’
item:
counter1
DeviceType
DeviceID
Switch
State
Unknown
repeat:
count: ‘{{ item | length }}’
sequence:
service: mqtt.publish
data:
topic: /ESP00/msg/{{item[repeat.index-1]}}
payload: ‘{{data[repeat.index-1]}}’