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.

Enhanced PVoutput driver in solar panels app with additional mobile capabilities

anneanne Member

Hi, 

I have added some mobile capabilities to the Solar Panels PVoutput driver. I have included the daily peak power as well as the totals of they month and year in the mobile view (besides the 'energy' and 'power' counters that the app already included). All parameters are tracked in the Homey insights view.

I have used a different part of the PVoutput API, the possibilities are endless (http://pvoutput.org/help.html#api). It's a shame the mobile capabilities can't be dynamically configured, it would be great if you could choose which parameters you would like to have in the mobile view. Let me know what you think. 



You can run/install the app from the command line if you fetch it here at the link below. I'll look into a pull reqluest so the author of the solar panels app can include the changes (if he wants to ;-)

https://github.com/abaretta/it.diederik.solar.git

Comments

  • lubbertkramerlubbertkramer Member
    edited March 2017
    Looking good, thanks already for the work i see you doing in the dev part of apps :)  Will favorite it so i can find it back when my solarpanels are placed 28 of april :) 
  • anneanne Member
    Nice :)  By that time you may want to check out 'PVoutputPro' for iOS or 'Mark McDonalds PVOutput' for Android. 

    PVoutputPro has nice options and graphs. The paid version has support for multiple systems, comparisons and estimates. 
  • Hi Anne,

    Do you have any ambition in further development of the PVOutput app? I'm a (paying) pvoutput user and use pvoutput to log generated and used electricity + water and gas usage. For water and gas usage I use the extra v7 - v10 parameters of pvoutput.

    It would be awesome if I could get all this info in my Homey and trigger flows on these values. Maybe there is a need for a separate PVOutput app???
    I don't know if there are other users who also use the advanced features of pvoutput.

    You can view my data here (click "show extended data" for gas and water usage) : https://pvoutput.org/intraday.jsp?id=20778&sid=18657
  • anneanne Member
    @deWekke, I am a paid PVoutput user as well. However I use a modbus power meter and upload the data to both homey as well as PVOutput, so I hadn’t really considered adding the power parameters. That is, until now, I agree it’s a good idea to add them. 

    At the time I did notify the creator of the solar app of the additions in the mobile interface, however he did not respond, and I didn’t create a pullrequest. I guess the way to go would be to get the parameters added to the solar app. I’ll have a look. 
  • @anne, maybe I'm asking too much because PVOutput is designed for power generation and consumption only. I'm (ab)using the exteded parameters to upload my gas and water usage values but it's not designed for that.

    In my case the data is not coming right out of a box. I have some scripting running on a server to collect all the data from my solar panels (via USB -> RS485) and my Fluksometer (power + water + gas consumption) and send it to PVoutput.

    On my previous HA controller (VeraEdge) I had some virtual devices and did some http requests from my scripting apps to feed the VeraEgde virtual devices with data. I guess this can be done also on Homey but I'm a starting Homey user so I still have a learning path to go.

    If you want extra info on how I use PVOutput to help out, you can always PM me.

  • anneanne Member
    You can use the http request app in combination with the  Better Logic app to send the data directly to Homey :+1: I have included an explanation I gave to someone else on slack below. 

    The Homey SDK does not have a good way to deal with custom/configurable capabilities unfortunately. This makes it difficult to use the extendable parameters in a sensible way in the app I am afraid. 


    Using http request app to receive data in / push data to Homey, for instance the temperature as reported by a sensor. 


    In Better logic, create a number variable for the temperature. Next create a flow with an HTTP trigger 'Ontvangen POST' ('Received POST' or something in english I guess).

    The trigger has a JSON tag. Drag this tag to the action column in a HTTP 'JSONpath Better Logic' action.

    In the trigger you need to fill in an identifier, let's call it 'python-temp'. This needs to be matched in the HTTP POST used to push data to Homey later on.

    In the JSONpath Better Logic action you fill in: '$.temp' in the first field, and your BL variable in the second.

    Now Homey is listening for HTTP POST directed towards <homey-IP>/api/app/com.internet/python-temp. Any JSON data posted here will be put in the BL variable, all you need to do is send some data.

    From a python script you could use a system call:
    os.system('/usr/bin/curl -H "HOST: <Homey-IP>" -H "Authorization: Bearer <bearer-token>" -H "Content-Type:application/x-www-form-urlencoded" -X POST <homey-IP>/api/app/com.internet/python-temp --data "temp={0:.3f}"'.format(temp))
    As you can see I call curl with a python system call in the example above, of course you can run curl from the shell as well, in that case leave out the python data formatting. It would look something like this:
    curl -H "HOST: <Homey-IP>" -H "Authorization: Bearer <bearer-token>" -H "Content-Type:application/x-www-form-urlencoded" -X POST <homey-IP>/api/app/com.internet/python-temp --data "temp=20”
    Note that you need to look up your 'bearer token' for authentication, it is part of the Homey URL when you are logged in (http://YourHomeysLocalIPAddress/?bearer_token=Deaf001000bad1000effe000hace000215c001).


  • @anne, thx for this information. I'll try this later when I have a bit more spare time

    Today I noticed that the values in Homey insights (from the solar panels app) are not the same as in PVoutput. Homey insiight values are a bit higher than PVoutput. Very strange

    Do you also have this?
  • anneanne Member
    No, for me the values are the exactly the same.
Sign In or Register to comment.