as I showed use value_json.state
You are overthinking this… just copy what I posted for the value_template. Don’t change it!
Oh your state topic will be “home/cabinet/temperature”
as I showed use value_json.state
You are overthinking this… just copy what I posted for the value_template. Don’t change it!
Oh your state topic will be “home/cabinet/temperature”
Okay, so I now have the following …
Sensor config:
- platform: mqtt
name: "Cabinet Temperature"
state_topic: "home/cabinet/temperature"
value_template: "{{ value_json.state }}"
MQTT integration settings:
Mosquitto broker settings:
logins: []
anonymous: false
customize:
active: true
folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false
My accesscontrollist
had the wrong username in it, and is now:
user mqtt
topic readwrite #
user homeassistant
topic readwrite #
The data are definitely turning up in MQTT:
… and yet the sensor trace is still empty
Nothing of interest is showing up in the server logs, and in fact as you can see from MQTT Explorer, Home Assistant is publishing its own events just fine.
Does it show anything in dev-tools for that sensor? Attributes etc? sensor.cabinet_temperature it should be called…
My script actually writes a json file… looks like {“state”:“12.3”} etc… maybe if you just pass {{ }} or {{ value_json }} to the sensor… the error seems to be in the sensor now you fixed mqtt. I am just writing a simple topic with the data in json as per above and it will write the 12.3 as the state etc… Assume you checked the docs. I just used the docs to work it out when I did it.
Ah! That solved it @DavidFW1960! When publishing raw numbers to the topic, I had to remove the value_template
field from the sensor config. It’s now just:
- platform: mqtt
name: "Cabinet Temperature"
state_topic: "home/cabinet/temperature"
… and, behold!
Thank you, @tom_l and @dproffer for your assistance. Do you think the final setup (i.e. for publishing raw numbers) might be worth documenting? Or would this forum post suffice?
You can edit the docs and add an extra example otherwise just this post. There’s possibly an issue with PR’s for the docs at the moment as I found when I tried to submit a PR today and I didn’t get the right link to sign the CLA…
Glad you got it worked out…
Hi,
Could you please post here all the final working configs?
I am new to homeassistant but so far am getting values like so
mysensors-pub/1/7/1/0/25 12.07
into rapsberry os if I check with mosquitto_sub -v -t mysensors-pub/#
but don’t know how to get this into HomeAssistant (running in docker) mysensors running on the linux os directly.
@duncan_bayne @DavidFW1960 I have exactly the same proble,
Everything seems to work. I can get results to MQTT exprorer running on my Windows PC and also one running on HA
If I comment out /config/rtl_433/rtl_433.conf.template
This is an empty template for configuring rtl_433. mqtt information will be
automatically added. Create multiple files ending in ‘.conf.template’ to
manage multiple rtl_433 radios, being sure to set the ‘device’ setting. The
device must be set before mqtt output lines.#output mqtt://${host}:${port},user=${username},pass=${password},retain=${retain},events=rtl_433[/model][/id]
I can see the measurements coming from SDR radio on logs (MQTT output disabled)
But the temperature is NOT coming to HA
My configuration.yaml is
And the “state_topic” value I got from MQTT explorer running in WINDOWS10 (but works also on HA)
“rtl_433/9b13b3f4-rtl433/devices/Nexus-TH/1/12/temperature_C”
I have tried with and without MQTT Auto Discovery.
I then even tried to send a test message via MQTT explorer…
The message appears on MQTT exprorer, but nothing on HA
OK…GOT IT!!
Open MQTT mosquitto from
then “CONFIGURE” and “Re-Configure MQTT”
There were a long password with random charachers…I replaces them to my onw defined user/pass
And it started to work…yeeee
Also easy to verify the functionality
Just put eg like this. Just put the same “topic” and just publish something…It shopuld appear under “Listening to topic”
For testing, you can use RAW as shown above.
For real data the configuration.yaml needs to be added
“value_template: “{{ value_json.temperature_C }}””
As MQTT broker will sent the temparature as json
eg
{“time”:“2023-02-02 13:05:25”,“model”:“Nexus-TH”,“id”:12,“channel”:1,“battery_ok”:1,“temperature_C”:-2.4,“humidity”:74}
therefore the configuration.yaml will be like this
More sensorts can be added accordinbgly
I did strugle a bit with this unknowning that the issue was just a wrong user/pass on MQTT config. But the good thing is that now I know how this MQTT works.
Ask if you have any issues related to this
Btw…the MQTT Auto Discovery is not needed if those sensors are added manually to configuration.yaml
I did play around with this…but didn’t understand how the discovery works. How the sensors appears to HA?
At least I didn’t find any “newely discovered devices” anywhere.