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.

How to retrieve data from Homey for website life presentation

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

  • edited April 2017
    You can take a look at the HomeyDash implementation: https://forum.athom.com/discussion/1736/beta-release-homeydash-a-dashboard-app-for-homey

    Please make sure to not expose your bearer token to the outside world :)
  • HansieNLHansieNL Member
    edited April 2017
    Have you looked at http app already? https://apps.athom.com/app/com.internet
  • swtttswttt Member
    Nice link <span>:smiley:</span>
  • HansieNLHansieNL Member
    edited April 2017
    swttt said:
    Nice link <span>:smiley:</span>
    Ooops... copied wrong link.
  • HansieNL said:
    Have you looked at http app already? https://apps.athom.com/app/com.internet
    thanks all for your answers.

     @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
  • anneanne Member
    edited April 2017
    I think you can do this with the A22 action card. It does an HTTP get and stores the result in a better logic variable. 

    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>&parameter=bla or something...


  • WRosWRos Member
    To get data from Homey, I made a script. It could be help you:
    https://github.com/WesRos/download.insight.homey
  • Thanks Anne and WRos, 

    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

  • WRosWRos Member
    I use one variable in Homey from another device. The values of a smart meter. I use the http app to get the values in Homey.
    It could be help you, but I don't think so. Take a look at: https://forum.athom.com/post/quote/2285/Comment_39916
  • Thanks WRos, just one question on your insight app:

    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) ?
  • WRosWRos Member
    The last is the entry: the log file, you could download in insight.
    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.
  • Hi WRos, I need some help regarding the curl_commands script. When I run the script all log files are empty and file not found errors are displayed. The curl command successfully retrieve data from Homey but the next two cause the errors. These lines are below. Could you please explain what these lines are doing?

    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"

  • anneanne Member
    The idea seems to be to remove possible duplicate entries in the logs. You'd think there wouldn't be any as the entries are time-stamped, but in some of the logs (at least mine) there are indeed duplicate entries.

    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.





  • WRosWRos Member
    edited April 2017
    The unique command is implement to combine the earlier log with the new one. Every night I run the script. The new lines will be added to the log files those where downloaded the night before.
    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.
Sign In or Register to comment.