Virtual meters, variables and API's
Solor panel data into virtual meter(s) with API's ?
The case:
It would be nice to have my solar panel data in the Zipabox dashboard as meter(s) and available in rules.
I want to make a rule that does a HTTP get every X minutes and store data received from the API in a virtual meter.
Anyone ideas or examples?
---------------------------
The solar panels inverter API:
(API GET:) https://monitoringapi.solaredge.com/site/<id>/overview?api_key=<my-key>
The (body) output of the API GET:
{
"overview": {
"lastUpdateTime": "2015-01-10 16:40:55",
"lifeTimeData": {
"energy": 1276190,
"revenue": 280.76178
},
"lastYearData": {
"energy": 24999.877
},
"lastMonthData": {
"energy": 24999.877
},
"lastDayData": {
"energy": 500.37598
},
"currentPower": {
"power": 0
}
}
}
Hello Theo,
I am trying to achieve something very similar : having a rule that will get a 3rd party device value (using Json) and putting this value in a Virtual device to get the value on the zipato dashboard.
Did you get an answer or found a way to achieve what you were looking for ?
Hello Theo,
I am trying to achieve something very similar : having a rule that will get a 3rd party device value (using Json) and putting this value in a Virtual device to get the value on the zipato dashboard.
Did you get an answer or found a way to achieve what you were looking for ?
This can be achieved in two ways, but both require a script running on a separate server/computer. To update devices by using the Zipabox API, you need to set up authentication (cookie with token). The second approach is using virtual device Url. It does not need authentication, but there is a kind of security by obscurity in it, because the url contains two or three generated GUIDs, making it "impossible" to guess. The virtual sensor/meter url will be the easiest approach.
This can be achieved in two ways, but both require a script running on a separate server/computer. To update devices by using the Zipabox API, you need to set up authentication (cookie with token). The second approach is using virtual device Url. It does not need authentication, but there is a kind of security by obscurity in it, because the url contains two or three generated GUIDs, making it "impossible" to guess. The virtual sensor/meter url will be the easiest approach.
I use the following scenario for lots of functionality:
- create a PHP script on my NAS (running a web server)
- this PHP does the http get and parses the json returned
- use the parsed values to set a virtual meter value in zipato using the values parsed from the NAS PHP script
Then on Zipato create a rule that does a http request calling the PHP script via the webserver on my NAS
Works flawlessly all the time. Only issue is when the zipato cloud services are down as virtual meters will not be updated on the zipatile by then.
My2c
I use the following scenario for lots of functionality:
- create a PHP script on my NAS (running a web server)
- this PHP does the http get and parses the json returned
- use the parsed values to set a virtual meter value in zipato using the values parsed from the NAS PHP script
Then on Zipato create a rule that does a http request calling the PHP script via the webserver on my NAS
Works flawlessly all the time. Only issue is when the zipato cloud services are down as virtual meters will not be updated on the zipatile by then.
My2c
I too use my NAS for multiple tasks like this. It really broadens the possibillities of things you can do with the Zipabox. I collect gas prices from my closes petrol station, read Netatmo values, control my Chromecast with TTS (still experimental, using PyChromcast), control my Samsung TV and some other stuff. I use Python and PHP in a similar ways as Roland does.
I too use my NAS for multiple tasks like this. It really broadens the possibillities of things you can do with the Zipabox. I collect gas prices from my closes petrol station, read Netatmo values, control my Chromecast with TTS (still experimental, using PyChromcast), control my Samsung TV and some other stuff. I use Python and PHP in a similar ways as Roland does.
An easy alternative to a NAS is running a Google App Script every few minutes to fetch the value and send it to a virtual meter. I use this to get weather data, the state of my Tado thermostat, and the state of my Roomba. Works very nicely.
An easy alternative to a NAS is running a Google App Script every few minutes to fetch the value and send it to a virtual meter. I use this to get weather data, the state of my Tado thermostat, and the state of my Roomba. Works very nicely.
Thanks to the various posts of David, I succeeded in creating a Google App Script that fetches the data from my solar panels, parse it and push it to my virtual meter.
This is the code I am using (tips for cleaner/better coding are welcome!):
Thanks to the various posts of David, I succeeded in creating a Google App Script that fetches the data from my solar panels, parse it and push it to my virtual meter.
This is the code I am using (tips for cleaner/better coding are welcome!):
Fantastic!
Fantastic!
Nicely Done, thanks for sharing!
Nicely Done, thanks for sharing!
Sorry for reviving this thread, but I was wondering What I should change in this script to make it work with the solaredge api. I found the api documentation (attached), but I'm not realy a programmer and can't get it to work.
Sorry for reviving this thread, but I was wondering What I should change in this script to make it work with the solaredge api. I found the api documentation (attached), but I'm not realy a programmer and can't get it to work.
Gilles' script, posted by him a few posts back.
Gilles' script, posted by him a few posts back.
Replies have been locked on this page!