This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
How to retrieve data from Homey for website life presentation
Hedzer
Member
in Developers
is there anybody that can help me how I can retrieve data (Temerature, door closed/open, better logic variable etc) to present it live on a website? Thanks to anyone who can give me directions
Comments
Please make sure to not expose your bearer token to the outside world
@HansieNL yes I did, but do not understand when I f.i. use the postcard for Jason (A31) with the following:
url:
http://www.myurl.com/receive_temp.html
Json value
{ "temp": #temperatuur}
How to catch that
URL: http://www.myurl.com/receive_temp.html, for the JSON path you would need to fill in '$.temp'. You can then store the number in a Better logic (number) variable (first add the BL variable in the Better Logic settings).
I use a similar logic to push data to Homey, works great
[edit] With this you would be able to get data from somewhere and use it in Homey, I guess it doesn't answer your original question. If you enter http://<homey-IP>/api/manager/insights/log you get all the app and device ID's, maybe you can fetch data that way, something like http://<homey-IP>/api/manager/insights/log/homey:device:<device-id>¶meter=bla or something...
https://github.com/WesRos/download.insight.homey
In order to bring data to Homey, I have found out (through the HTTP app), what I would like to achieve is to read from the Homey or even better to send based on a trigger in a flow (when a variable has changed) the data to my browser.
I will absolutely check both your ways of doing. The insight app from @WRos is still a bit difficult for me to understand as I am not familiar with cron and curl,
Will keep you posted, H
It could be help you, but I don't think so. Take a look at: https://forum.athom.com/post/quote/2285/Comment_39916
You reach out to a command line http://"$ip"/api/manager/insights/log/"$uri"/"$name"/entry"
What would this look like if you would put this in the browser url field ? Specific the $name and entry part. The $ip I understand, the $uri I think is the "homey:device:longdeviceID", but the last part I do not understand.
Also referring to the insight/log I would think you will need a time stamp in order to retrieve a single value (last value) ?
The script will only download the whole log file.
To get a actual value, I think you could use better logic. I never did it. I think that someone has explain this on this forum.
cat "/home/rob/Homey/Logs/SolarEdge_meter_power.log" "/home/rob/Homey/Logs/SolarEdge_meter_power_new.log" | uniq > "/home/rob/Homey/Logs/SolarEdge_meter_power.log"
rm "/home/rob/Homey/Logs/SolarEdge_meter_power_new.log"
What would work is to replace the two lines with something like 'uniq file file_new && mv file_new file', or:
The following works:
echo "uniq \""$save_folder"/"$logname"_"$name".log\" \""$save_folder"/"$logname"_"$name"_new.log\" && mv \""$save_folder"/"$logname"_"$name"_new.log\" \""$save_folder"/"$logname"_"$name".log\"" >> curl_commands
This way you get all the data from Homey in the 'insights' directory.
You could comment these last two lines out by a # before the line.
Run the script, and check the different between the new and the "old" log file.