Removed temperature reading

This commit is contained in:
Ollo
2021-01-14 21:16:12 +01:00
parent 9d764a3b8e
commit d1b5e67ce6
2 changed files with 0 additions and 163 deletions

View File

@@ -38,32 +38,10 @@ function startMqtt()
end)
end
function readTemp()
if (t ~= nil) then
addrs=t.addrs()
-- Total DS18B20 numbers
sensors=table.getn(addrs)
local temp1=0
if (sensors >= 1) then
temp1=t.read(addrs[1])
end
return temp1
else
return nil
end
end
function startMqttClient()
if (mqttServer ~= nil and mqttPrefix ~= nil) then
startMqtt()
print "Started MQTT client"
if (file.open("ds18b20.lc")) then
t=require("ds18b20")
t.setup(2) -- GPIO4
readTemp() -- read once, to setup chip
print "Setup temperature"
end
oldBrightness=0
oldTemp=0
tmr.alarm(5, 5001, 1 ,function()
@@ -74,9 +52,6 @@ function startMqttClient()
end
if (oldBrightness ~= briPercent) then
m:publish(mqttPrefix .. "/brightness", tostring(briPercent), 0, 0)
elseif (temp ~= nil and temp ~= oldTemp) then
oldTemp = temp
m:publish(mqttPrefix .. "/temp", tostring(temp), 0, 0)
else
m:publish(mqttPrefix .. "/heap", tostring(node.heap()), 0, 0)
end