I would like to read a text file located on a local webserver with adress: http://192.168.0.3/rgt.txt
The only contet in the text file is the current exhaust gas tempereature of my boiler with one decimal, example: 231.8
Every five minutes I would like to assign/store the temperature to a virtual temp sensor that I have created with idx: 104
I have found a couple of examples on this forum that is similar and tried to modify them for my needs. But I can't get it to work, so I would be really glad for some help.
Read text file and assign value to virtual temp sensor?
Moderator: leecollings
-
- Posts: 247
- Joined: Sunday 29 November 2015 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.9639
- Location: Spain
- Contact:
Re: Read text file and assign value to virtual temp sensor?
Maybe post what you have so far here ?
-
- Posts: 6
- Joined: Monday 05 October 2015 20:54
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.5877
- Location: Sweden
- Contact:
Re: Read text file and assign value to virtual temp sensor?
It was a mess before
I have tried around with mixing different examples now. And it seems to be working, but I will be glad for any comments to make it more "correct" of course.
I have tried around with mixing different examples now. And it seems to be working, but I will be glad for any comments to make it more "correct" of course.
Code: Select all
commandArray = {}
now=os.date("*t")
if now.min % 5 == 0 then -- set interval of script running
local f = assert(io.popen("curl -s http://192.168.0.3/rgt.txt" , 'r'))
local rgttemp = assert(f:read('*a'))
print(rgttemp)
commandArray["UpdateDevice"] = "104|0|".. rgttemp ..""
end
return commandArray
-
- Posts: 18
- Joined: Thursday 10 May 2018 10:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: V8.153
- Location: Oss The Netherlands
- Contact:
Re: Read text file and assign value to virtual temp sensor?
Dear Landsmer
Thry looking in this post regarding setting the lua script correctly
viewtopic.php?t=12087
code for updating the virtual sensor
regards
jack
Thry looking in this post regarding setting the lua script correctly
viewtopic.php?t=12087
code for updating the virtual sensor
regards
jack
5 x raspberry with Domoticz, open hab, Home assitant, OpenElec Kodi.
Interests Home automation
Interests Home automation
Who is online
Users browsing this forum: No registered users and 1 guest