-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Home Assistant Gather Temperature Data via JSON Possible missing "}" #52
Comments
upon further inspection, i think there is a "}" missing from i created a new sensor that uses the periodic maybe this is a bug? |
I have confirmed that the issue is the lack of a } in the json ouput to MQTT i haven't figured out where exactly to put this extra } so i put it here if (dht_readTempHum(TEMP_CONVERSION, t, h)) { // Read temperature This sends tele/sonoff/SENSOR {"Time":"2017-02-10T21:19:13", "DHT":{"Temperature":"73.0", "Humidity":"23.9"}}} @arendst I'm sure there is somewhere in the code to make sure the let me know if i need to clarify anything else. |
Thnx for the research! You're probably right. I will find the correct location for the brace and release an update next week. |
No problem, i did change on line in the code and that fixed the response for the stat/sonoff/STATUS10 so the first didn't add another } at the end, it inclosed the Time: field I'm just kinda writing down what i find here. hopefully it will make it easier for you to fix the code. cheers |
Hello, STATE {"Time":"2017-02-11T00:08:53", "Uptime":127, "POWER":"off", "Wifi":{"AP":1, "SSID":"Spandau5", "RSSI":74}} I have got this error message: This came up with all from the Sonoffxx sendings in MQTT JSON Format strings. So I think citrusfizz directed in the correct direction, that there is some Thing faulty at the beginning of the JSON String. @theo, I hope you can solve it. Thanks in advanced. By the way, Theo, another question: What is the reason, you are using this special Format? |
@citrusfizz
(Remove the test for DJSON). @Mickbaer
Where do you get the error message from? About the datetime string: As I (and most software) hate spaces there is a T between date and time string. |
@citrusfizz Fixed in version 3.9.14 just released |
Awesome, Quick turn around. I will test it now |
@arendst sensor:
The first two will pick up the temp and humidity on the DHT22 sensor output when there is a mqtt pub request like this This will be called from the HASS application, i just haven't gotten to that part yet. so if you load this exact same config (as long as you have your MQTT server settings defined in HASS), it will read data when that mosquitto pub is ran. the last sensor picks up what the SONOFF and this software sends periodically and it done automatically at this point. This periodic interval can be changed (see the wiki or the MQTT commands) ok i am two hours late for a family function, gotta run. Thanks again @arendst |
Thnx. I'll add your config to the wiki as many people seem to have trouble configuring Home Assistant |
3.9.14 20170211 * Add False and True as alternatives for 0/Off and 1/On (arendst#49) * Fix Status10 JSON format (arendst#52) * Fix DS18x20 using OneWire library (arendst#53)
I'm trying to get Temp data with my DHT22 via HomeAssistant
Running this command
mosquitto_pub -h localhost -p 8883 -t 'cmnd/sonoff/status' -m '10'
outputs this
stat/sonoff/STATUS10 {"StatusSNS":{"Time":"2017-02-10T19:27:09", "DHT":{"Temperature":"69.8", "Humidity":"26.9"}}
I'm trying to capture this with home assistant. if anyone has done this please hit me up. it was easier with not having to parse JSON before.
sensor:
state_topic: 'stat/sonoff/STATUS10'
command_topic: 'cmnd/sonoff/status'
payload: '10'
name: 'Temperature'
unit_of_measurement: '°F'
value_template: '{{ value_json.StatusSNS.DHT.Temperature }}'
but i get an error saying it can't parse it
INFO:homeassistant.core:Bus:Handling <Event mqtt_message_received[L]: topic=stat/sonoff/STATUS10, payload={"StatusSNS":{"Time":"2017-02-10T19:33:25", "DHT":{"Temperature":"70.0", "Humidity":"27.0"}}, qos=0>
ERROR:homeassistant.helpers.template:Error parsing value: 'value_json' is undefined (value: {"StatusSNS":{"Time":"2017-02-10T19:33:25", "DHT":{"Temperature":"70.0", "Humidity":"27.0"}}, template: {{ value_json.StatusSNS.DHT.Temperature }})
The text was updated successfully, but these errors were encountered: