I’m wondering if someone can help me out. I’m running a Domoticz instance to gather data from NIBE heatpump API (https://www.domoticz.com/forum/viewtopic.php?t=13640) and would of course like to move some of this data into HA… I’ve setup Domoticz to send MQTT messages as value updates and they look like this:
What I’m failing to do is to write some value-template to extract this. Since all messages are received in the same topic I’m thinking that I should like filter a sensor for this on the id 82019 and store the svalue 45.3.
Thank for looking into this! I guess that should work but I’m trying to extract svalue1 WHEN id=X
Domoticz sends all sensors on domoticz/out so svalue1 changes several times every five minutes since there are several sensors having this value, all with different ID’s. So my idea, which I failed to put into action, was to setup several sensor and write a template that extracted the right value for each, identified by id.
I bet you can handle this with a single automation and exploit the fact that attributes of the trigger are available as variables within an automation. Creative use of scripts (they can accept arguments) or templating within an action can handle things based on the incoming ID.
Johan. I’m trying to do the same but can’t seem to get things working.
Did you manage to get the sensor readings from the different sensors? If so please show me a working config and where put things. After a two days struggling with this i’m begingen to think the move to home assistant isn’t going to work for me.
No I spent some time on it and then lost it, but I would like to get back to it because it is something I need. I’m afraid my knowledge is to shallow in this case but I think the solution could be setting up mqtt sensor with a value template
It has to to with my not understanding the formatting.
What I tried to do is test if idx has value x and that works. If true get the svalue5 and put it in the sensor. that also works but if another idx passes I get notting. What I want is that the sensor ignores the other idx.
I finally solved this in an non-HA way… I take the MQTT-messages from Domoticz filter them in Node-Red and send off new mqtt-messages that are better structured for use in HA… Easy solution that works perfectly, if you have a node-red server…
I have a “common” mqtt channel for multiple iBeacons and need to extract the battery level for a specific one. I’m using automation to monitor/filter the mqtt channel and extract it’s encoded battery level. I then use the community’s variable component to store and display in the UI:
1.In Domoticz: place the sensor in a floorplan, set mqtt topic to “/” (basically have a separate topic for the sensor; haven’t checked if multiple floorplans could be set, so each sensor has its own). Then in HA the sensor would be:
Use flat (“out”) or flat + hierarchical ( “out + /” if needed to combine with first option above) topic for mqtt in Domoticz and set an automation that would read each sensor (no need for floorplan). #automation - based on the payload in the first message. If weather station has only temperature readings lose the second sensor.
I am using the “RTL_433 to MQTT Bridge” hassio addon, and I needed to receive a temperature sensor and a remote. The addon can only publish to a single topic, and the MQTT sensor component was confused by receiving two payloads with different structure.
I made one MQTT generic topic and two automations as you suggested that filter the messages and republish them on different topics, that can be undertood by the standard MQTT sensor and MQTT switch.
The RTL Bridge addon publishes to the “homeassistant/sensor/rtl433” topic. These are the automations:
I am looking some help in similar issue - mqtt templating.
I am integrating RF433 sonoff gateway flashed with Tasmota. The gateway sends mqtt messages to only one predefined topic 09:27:11 MQT: tele/RF433/RESULT = {"RfReceived":{"Sync":12780,"Low":400,"High":1250,"Data":"3445A2","RfKey":5}}
I am looking for a way to build conditional automation that only triggered if specific Data or RfKey received.
My automation example (which does not work is here:
- alias: Magic light toggle
hide_entity: true
trigger:
platform: mqtt
topic: tele/RF433/STATE
action:
service: light.toggle
entity_id: light.magic_led_kids
condition:
condition: template
value_template: ‘{{ “3445A2” in trigger.payload}}’
I guess my value_template is not correct, any help?
Yep, I am subscribed to the topic in my linux pc terminal and I can see the json messages being published by RF hub
Client mosqsub|4809-aleksejs-p received PUBLISH (d0, q0, r0, m0, ‘tele/RF433/RESULT’, … (76 bytes))
{“RfReceived”:{“Sync”:10240,“Low”:320,“High”:940,“Data”:“CA2F0E”,“RfKey”:4}}
I don’t see 3445A2 in the payload so it is normal that the automation doesn’t fire. Is it possible that the device sends two codes? What type is it (PIR/OpenDoor sensor)?
Yes, you are right in the sense the code in not in the payload. Just picked random example from the output in the terminal.
Here is the relevant mqtt message.