Youless intergration

Ah that’s because of a breaking change in HA 8.something. You can fix it like this:

  1. create a folder inside ‘custom_components’ called ‘youless’
  2. copy the youless.py file into that folder
  3. rename youless.py into sensor.py
  4. restart HA

Thanks for your kind update!
I did what you suggested.
Log is now ok, no errors there.

But the configuration validation still has an issue with it:

Integration youless not found when trying to verify its sensor platform.

This is still what I have in the configuration.yaml:

  - platform: youless
    name: Youless
    host: x.x.x.x (real ip here of course)
    monitored_variables:
     - pwr
     - net
     - p1
     - p2
     - n1
     - n2
     - cs0
     - ps0
     - gas

No new items in the lovelace interface popping up.

Hope you have defined the sensor class as well like this:

sensor:
  - platform: youless
    name: youless
    host: x.x.x.x
    monitored_variables:
       - pwr
       - net
       - p1
       - p2
       - n1
       - n2
       - cs0
       - ps0
       - gas

Found the culprit!
Digging through other custom_components at Github, I found this:

add empty file init.py to fix custom components not loading on 0.92

And boom, working.

Thanks for your help pdwonline!

i add the configuration at my configuration.yaml

but how do i findt it in home assistent ui

I am a newbie to HASS, but have been digging in for the last few days.
Can you explain how to get the Youless integration working?

Youless is not natively supported by home assistant. You either have to configure it using the rest sensor of home assistant. Or you can install a custom component and configure that. Instructions on installing the custom component are included in the readme file.

Do note that I try to keep the component up to date with breaking changes from home assistant, but it provided a is without official support.

Hi there,

was looking into this. Using the rest function works, but I cannot get the add-on working. I have the latest HA and installed the folders. Added also:

sensor:

  • platform: youless
    name: youless
    host: x.x.x.x.
    monitored_variables:
    • pwr
    • net
    • p1
    • p2
    • n1
    • n2
    • cs0
    • ps0
    • gas
      But keep getting the error in the configuration checker:

Platform error sensor.youless - Integration youless not found.

How can I solve this?
oh of course the o are dashes

I ended up putting everything in configuration.yaml en directly reading the data from the webpage on the Youless. These commands need to be defined as a sensor, so under a 'sensor: ’ header.

  - platform: command_line
    name: youless
    json_attributes:
    - net
    - gas
    - pwr
    - ts0
    - cs0
    - ps0
    - p1
    - p2
    - n1
    - n2
    command: 'curl -X GET http://<your Youless IP>/e | jq -c ".[0]"'
    value_template: 'OK'
  - platform: template
    sensors:
      youless_meterstand:
        value_template: "{{ state_attr('sensor.youless','net') }}"
        entity_id: sensor.youless
        friendly_name: 'Meterstand'
        unit_of_measurement: 'kWh'
      youless_gas:
        value_template: "{{ state_attr('sensor.youless','gas') }}"
        entity_id: sensor.youless
        friendly_name: 'Gas meterstand'
        unit_of_measurement: 'm3'
      youless_power:
        value_template: "{{ state_attr('sensor.youless','pwr') }}"
        entity_id: sensor.youless
        friendly_name: 'Huidig verbruik'
        unit_of_measurement: 'W'
      youless_power_production:
        value_template: "{{ state_attr('sensor.youless','ps0') }}"
        entity_id: sensor.youless
        friendly_name: 'Huidige opbrengst'
        unit_of_measurement: 'W'
      youless_consumption_high:
        value_template: "{{ state_attr('sensor.youless','p2') }}"
        entity_id: sensor.youless
        friendly_name: 'Verbruik Hoog'
        unit_of_measurement: 'kWh'
      youless_consumption_low:
        value_template: "{{ state_attr('sensor.youless','p1') }}"
        entity_id: sensor.youless
        friendly_name: 'Verbruik Laag'
        unit_of_measurement: 'kWh'
      youless_production_high:
        value_template: "{{ state_attr('sensor.youless','n2') }}"
        entity_id: sensor.youless
        friendly_name: 'Terug geleverd Hoog'
        unit_of_measurement: 'kWh'
      youless_production_low:
        value_template: "{{ state_attr('sensor.youless','n1') }}"
        entity_id: sensor.youless
        friendly_name: 'Terug geleverd Laag'
        unit_of_measurement: 'kWh'
      youless_production:
        value_template: "{{ state_attr('sensor.youless','cs0') }}"
        entity_id: sensor.youless
        friendly_name: 'Productie Zonnepanelen'
        unit_of_measurement: 'kWh'


In my case there are solar panels on my second input.
This works like a charm and there is no need for a custom componenten.

3 Likes

Wow that’s a nice implementation. Thanks for sharing. I was wondering how can I calculate with these values. I mean Gas is just a counter but I want to know what is actual used that hour or day. Not only total counter.

Using my OTGW i can see when my boiler’s flame is burning, but not how much it is using.
The Youless does not give actual (live) usage, because the status is only send from the gas-meter to the ‘smart’-meter every 15 minutes, as far as i know.

But you could accomplish daily/hourly use by storing the current value at 0:00 and every hour after, and calculate. I just don’t know how to do that in HA…:frowning:

Hi @Davey400
Thank you for this code, very helpful.
I have water on cs0 so that was easy to change.
Have a question/suggestion however:

  • do you happen to know where the indication “peak/low” can be detected? Maybe this is just a Yes/No determined from whatever is running (hoog or laag)?
  • Youless doesn’t give parameters for gass/cs0 “usage” or “delivery”(in case of solar). Do you have an idea how to show this in HAS? Could be diff t0/t-1 and if t0=t-1-> avg(t0-t-x)… any ideas?
  • Do you know what ts0 means?
    Thanks for your support,
    KR,
    F

For me works:
command: ‘curl -X GET http://<your Youless IP>/a?f=j’

There now is a pull request open to add an integration to home assistant core with youless support under https://github.com/home-assistant/core/pull/41942

Now that I’ve build a pip module to interact with the YouLess API for the LS120 and creating an integration for Home Assistant (pending merge into Home Assistant core) it is time for the next step.

I would like to build in support for the LS110 device as well, but need some help from someone that has one. I know that the current ‘/e’ end-point I’m using is not available on this model. But what I’m hoping for is that the ‘/d’ end-point is available. This should expose the model number of the device.

Can anyone with a LS110 device please confirm this. If these devices support the ‘/d’ then I should be able to detect if the integration is talking to a LS120 or LS110 device and adjust the API calls to get the data.

I got the latest custom component version from november 2020 working in HA
https://bitbucket.org/jongsoftdev/youless/src/master/custom_components/youless/

but there is something wrong with my values, usage is shown in kW but should by in W. Is there a way I can change this?

For adding the custom icon, do I need to use HACS?

regards
Walter

That would be a bug in the library underneath. I will create a fix for that soon and publish it.

Edit: I updated the custom component in the repository that you are using. This should contain a fix. I’m currently in the works of updating the component in the pull-request so that this is up to date as well.

It is fixed with the latest update, thanks for the quick support!

Screenshot 2020-12-20 at 11.25.37

I had some problems with having 2 Youless L120 units.
Finally I have managed to get it work.
This is what I did

  • platform: command_line
    name: youless_pwr_wp
    json_attributes:

    • pwr
      command: ‘curl -X GET http://<IP-address Youless 1>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘pwr’) }}”
      unit_of_measurement: “Watt”
  • platform: command_line
    name: youless_net_wp
    json_attributes:

    • net
      command: ‘curl -X GET http://<IP-address Youless 1>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘net’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_pwr_mk
    json_attributes:

    • pwr
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘pwr’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_net_mk
    json_attributes:

    • net
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘net’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_p1_mk
    json_attributes:

    • p1
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘p1’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_p2_mk
    json_attributes:

    • p2
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘p2’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_n1_mk
    json_attributes:

    • n1
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘n1’) }}”
      unit_of_measurement: “kWh”
  • platform: command_line
    name: youless_n2_mk
    json_attributes:

    • n2
      command: ‘curl -X GET http://<IP-address Youless 2>/e | jq -c “.[0]”’
      value_template: “{{ state_attr(‘sensor.youless’,‘n2’) }}”
      unit_of_measurement: “kWh”
      ===========================
2 Likes

I have an LS110 and it does not respond to /e or /d

What is needed to integrate this version of the youless? I have followed the instructions. After ‘add integration’ and some installation, two inputs are requested. One is not labelled, the other is labelled host. The latter being the IP address of the device, but what needs to be entered in the first field?