Domoticz read realtime.txt
Moderator: leecollings
Domoticz read realtime.txt
Is it possible to make Domoticz to read a realtime.txt file that generate from Cumulus?
Re: Domoticz read realtime.txt
Hi again
I trying now to build my own but I have a litle problem with the API/JSON of Domoticz
I have create a Virtual sensors and a device that have "Temp" as type
everything looks fine and is time to insert info
Before I did connect all my script I did make it easy and just write a static value of the weather to a webbrowser
as you can see the idx number is 15 and the value is set to 1.2
I get no error
I trying now to build my own but I have a litle problem with the API/JSON of Domoticz
I have create a Virtual sensors and a device that have "Temp" as type
everything looks fine and is time to insert info
Before I did connect all my script I did make it easy and just write a static value of the weather to a webbrowser
Code: Select all
http://<ipaddress>:8080/json.htm?type=command¶m=udevice&idx=15&nvalue=1.2
I get no error
but I get no update in the device?{
"status" : "OK",
"title" : "Update Device"
}
Re: Domoticz read realtime.txt
Have got it to work 

-
- Posts: 135
- Joined: Friday 13 November 2015 9:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands, Emmen Area
- Contact:
Re: Domoticz read realtime.txt
What have you changed to get it work?
I'm interest.
I'm interest.
Re: Domoticz read realtime.txt
Well this page is a BIG help
https://www.domoticz.com/wiki/Domoticz_ ... .2Fsensors
I did notice that my address was not complete
So maybe soon I can get my info to my weather system at home
https://www.domoticz.com/wiki/Domoticz_ ... .2Fsensors
I did notice that my address was not complete
So maybe soon I can get my info to my weather system at home

-
- Posts: 135
- Joined: Friday 13 November 2015 9:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: The Netherlands, Emmen Area
- Contact:
Re: Domoticz read realtime.txt
The text file is imported with http/https poller?
Re: Domoticz read realtime.txt
All I do is read the textfile with python
Split where it is space and then use the array in the http protocol to send info to the Domoticz
A example to write the temp
Split where it is space and then use the array in the http protocol to send info to the Domoticz
A example to write the temp
Code: Select all
file = open("realtime.txt", "r")
vader = file.read().split(" ")
response = urllib2.urlopen('http://<ipaddress>:<port>/json.htm?type=command¶m=udevice&idx=15&nvalue=0&svalue=' + vader[2])
-
- Posts: 7
- Joined: Wednesday 11 October 2017 23:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Domoticz read realtime.txt
Hi Cazz,
I'v been trying to get it ro work on my Pi Zero, but sofar no luck.
All i get is when i'm usong the code as you described in the previous reply:
File "weerstation.py", line 3, in <module>
response = urllib2.urlopen('http://<ipadres>:<port>/json.htm?type=command¶m=udevice&idx=4178&nvalue=0&svalue=' + vader[2])
NameError: name 'urllib2' is not defined
How to go from here??
I'v been trying to get it ro work on my Pi Zero, but sofar no luck.
All i get is when i'm usong the code as you described in the previous reply:
File "weerstation.py", line 3, in <module>
response = urllib2.urlopen('http://<ipadres>:<port>/json.htm?type=command¶m=udevice&idx=4178&nvalue=0&svalue=' + vader[2])
NameError: name 'urllib2' is not defined
How to go from here??
Re: Domoticz read realtime.txt
Hmm it was sometime now I did work with this (I run now Hassio) but what I can read is something with the python script
Not sure if that help but look at this page
https://stackoverflow.com/questions/279 ... 2/38906959
At first you can see when you run your address in a browser that it show a value and no error.
Make the address static and put that in a browser and see if you get a value or a error
If you got a value then it mean that urllib2 to get the info. if you get a error then is something with the info you trying to get that is wrong.
Not sure if that help but look at this page
https://stackoverflow.com/questions/279 ... 2/38906959
At first you can see when you run your address in a browser that it show a value and no error.
Make the address static and put that in a browser and see if you get a value or a error
If you got a value then it mean that urllib2 to get the info. if you get a error then is something with the info you trying to get that is wrong.
Who is online
Users browsing this forum: Google [Bot] and 1 guest