I am new to this forum, so please let me know if this topic should be put somewhere else.
At this moment I use a Sonoff S20 with tasmota firmware and a BME280 sensor connected to it.
I have no problems at all with this code (will show the problem in a bit!)
I send a http request :
Code: Select all
http://192.168.10.4/cm?cmnd=status%2010
Code: Select all
{
"StatusSNS": {
"Time": "2020-02-15T20:37:04",
"BMP180": {
"Temperature": 17.3,
"Pressure": 1008.4
},
"PressureUnit": "hPa",
"TempUnit": "C"
}
}
Code: Select all
if (item.isHTTPResponse) then
if (item.statusCode == 200) then
if (item.isJSON) then
local myTemperature = item.json.StatusSNS.BMP180.Temperature
local myPressure = item.json.StatusSNS.BMP180.Pressure
-- update device in Domoticz
domoticz.devices('Sonoff_TB').updateTempHumBaro(myTemperature,'0','0', myPressure)
The resonse:
Code: Select all
{
"StatusSNS": {
"Time": "2020-02-15T20:45:10",
"SHT3X-0x44": {
"Temperature": 19.6,
"Humidity": 54.1
},
"TempUnit": "C"
}
}
Code: Select all
local myTemperature = item.json.StatusSNS.SHT3X-0X44.Temperature
Code: Select all
local myTemperature = item.json.StatusSNS.'SHT3X-0X44'.Temperature
and
local myTemperature = item.json.StatusSNS."SHT3X-0X44".Temperature
Thanks in advance.