For people with an BME280 sensor on their Luftdaten sensor...
Apparently with one of the updates, the values of humidity and pressure swapped in the json output.
Pressure data now comes before Humidity:
Code: Select all
curl http://---IP ADDRESS---/data.json
{"software_version": "NRZ-2019-125-B1", "age":"65", "sensordatavalues":[{"value_type":"SDS_P1","value":"826.93"},{"value_type":"SDS_P2","value":"95.77"},{"value_type":"BME280_temperature","value":"10.68"},{"value_type":"BME280_pressure","value":"98219.00"},{"value_type":"BME280_humidity","value":"90.94"},{"value_type":"samples","value":"2491522"},{"value_type":"min_micro","value":"55"},{"value_type":"max_micro","value":"370429"},{"value_type":"signal","value":"-9"}]}
So the dzVents script has to be slightly modified:
Code: Select all
return {
active = true,
on = {
timer = { 'every minute' },
httpResponses = { 'luftdatenRetrieved' } -- matches callback string below
},
execute = function(domoticz, item)
if (item.isTimer) then
domoticz.openURL({
url = 'http://---IP ADDRESS---/data.json',
method = 'GET',
callback = 'luftdatenRetrieved'
})
elseif (item.isHTTPResponse) then
if (item.ok and item.isJSON) then -- statusCode == 2xx
if tonumber(item.json.age) < 60 then
-- OLD: 1: SDS_P1 PM10, 2: SDS_P2 PM2.5, 3: BME280 temp, 4: BME280 hum, 5: BME280 baro
-- 1: SDS_P1 PM10, 2: SDS_P2 PM2.5, 3: BME280 temp, 4: BME280 baro, 5: BME280 hum
domoticz.devices('Luftdaten PM10').updateCustomSensor(item.json.sensordatavalues[1].value)
domoticz.devices('Luftdaten PM2.5').updateCustomSensor(item.json.sensordatavalues[2].value)
if (tonumber (item.json.sensordatavalues[3].value) < 100) and (tonumber (item.json.sensordatavalues[5].value) < 105000) then
-- domoticz.devices('Luftdaten BME280').updateTempHumBaro(item.json.sensordatavalues[3].value,item.json.sensordatavalues[4].value,0,(item.json.sensordatavalues[5].value/100),0)
domoticz.devices('Luftdaten BME280').updateTempHumBaro(item.json.sensordatavalues[3].value,item.json.sensordatavalues[5].value,0,(item.json.sensordatavalues[4].value/100),0)
end
end
else
-- oops
domoticz.log('Error fetching Luftdaten data', domoticz.LOG_ERROR)
domoticz.log(item.data, domoticz.LOG_ERROR)
end
end
end
}
Ewald....