Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
return {
on = {
devices = {
2, -- 2 Living room -- 3 Bedroom -- 4 Bathroom -- 5 Guest room -- 6 Office, --35 Kitching
3,
4,
5,
6,
35
}
},
logging = {
--level = domoticz.LOG_INFO,
marker = "evohome_push"
},
data = {
-- Store temp and setpoints in table
lasttemperature = { initial = {} },
lastsetpoint2 = { initial = {} },
-- Influx database URI, including database name
influxURI = { initial = 'http://localhost:8086/write?db=smarthome&precision=s' }
},
execute = function(dz, dev)
-- if temp or setpoint changed, push to influxdb
if (dev.temperature ~= dz.data.lasttemperature[dev.name] or
dev.setPoint ~= dz.data.lastsetpoint2[dev.name]) then
dz.data.lasttemperature[dev.name] = dev.temperature
dz.data.lastsetpoint2[dev.name] = dev.setPoint
dz.log('Device ' .. dev.name .. ' was changed. Temp: ' .. tostring(dev.temperature) .. ' setpoint: ' .. tostring(dev.setPoint), dz.LOG_INFO)
-- Push new temperature to influxdb, both actual and setpoint. Strip
-- device names from spaces for tags in influxdb.
-- format v1
-- dz.openURL({
-- url = dz.data.influxURI,
-- method = 'POST',
-- postData = "temperature,type=heating,device="..dev.name:gsub("%s+", "")..",subtype=actual value=" .. tonumber(dev.temperature) ..
-- "\ntemperature,type=heating,device="..dev.name:gsub("%s+", "")..",subtype=setpoint value=" .. tonumber(dev.setPoint)
-- })
-- format v2
dz.openURL({
url = dz.data.influxURI,
method = 'POST',
postData = "temperaturev2 "..dev.name:gsub("%s+", "").."=" .. tonumber(dev.temperature) .. ","..dev.name:gsub("%s+", "").."_set=" .. tonumber(dev.setPoint)
})
else
dz.log('Device ' .. dev.name .. ' was not changed.')
end
end
}