Youless and OpenHAB + Grafana

A while ago i started using OpenHAB in my home. For this i bought a raspberry pi, Aeotec z-wave stick, 3 power meters and a fibaro switch and roller shutter.I had a little trouble getting started and understanding how it works, but with the help of a friend i managed to make a start.

One nice thing in OpenHAB are panels you can create with HABPanel. My ultimate goal is to have tablet lying around in the living room to control and see the status of things/items in my house. One thing i wanted to see was the power consumption of my house and split PV output. Currently i use a youless to measure this. The youless is connected to enelogic which has some nice dashboards but not so easy to add to OpenHAB. Fortunately youless has also a interface to collect data in json format. This was easy to implement in OpenHAB. So i made this HABPanel:

I thought it would be nice to share how i did it. Although it is fairly simple to do it, finding out how took me quite some time. First you need to install the following add-ons: HTTP binding and JSONPath Transformation. Once you have those installed you need to create an item. You can do this by creating an .item file in /etc/openhab2/items. For example youless.item. Below you can find mine (i have a youless LS110 and LS120, LS110 is for measuring a car charing station):

//----- Energy
Number Youless_NetUsage "Netto verbruik" { http="<[http:///a?f=j:5000:JSONPATH($.pwr)]" }
Number Youless_PV "ZP Opbrengst" { http="<[http:///a?f=j:5000:JSONPATH($.ps0)]" }
Number Youless_Gross "Bruto verbruik"

Number Youless_CarCharcher "Laadpaal verbruik" { http="<[http:///a?f=j:5000:JSONPATH($.pwr)]" }

And actually thats it. When you add a widget you can find the Youless items. As you can see there is a Youless_Gross, this is a virtual item. The Youless only supplies net use and PV output. Not what you are actually using. So i am using a rule to calculate this item. The rule i am using:

rule "Update youless gross usage"
when
   Item Youless_NetUsage changed or
   Item Youless_PV changed
then
   var gross_value = (Youless_NetUsage.state as Number) + (Youless_PV.state as Number)
   Youless_Gross.postUpdate(gross_value)
   logInfo("info","Updated Youless gross")
end

Nice addition is that i can graph this data in Grafana. I also have the InfluxDB persistence plugin installed.

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.

2 Responses to Youless and OpenHAB + Grafana

  1. Dick says:

    Hey Luke,

    I’m a new user of openHAB and use a Youless 120 to see the realtime power use.
    I tried to add the youless to openHAB, by making the item file and insert the HTTP binding and JSONPath Transformation, but so far i get only a NULL as output.
    Can you guide me step by step to get a positive result?
    Thanks in advance,
    Dick

  2. nua says:

    I also have the problem with openhab3… can you help with that?

Leave a Reply

Your email address will not be published. Required fields are marked *