Youless: Sensors for detailed information per phase

As per YouLess Firmware version 1.5.0 released on 16-6-2022 power information per phase is available. See screenshot:


It would be great if we can expose this information as sensors.

Would like that to.

Here some extra info:
They are on the page Youless-ip/f
Exampele of my Json output:
{"ver": 50,"tr": 2,"i1": 0.000,"i2": 0.000,"i3": 2.000,"v1": 231.600,"v2": 230.400,"v3": 233.100,"l1": 64,"l2": 103,"l3": 312}

ver: P1 port version
tr: Current tariff (1 or 2)
i1: Current phase 1
i2: Current phase2
i3: Current phase 3
v1: Voltage phase 1
v2: Voltage phase 2
v3: Voltage phase 3
l1: Power phase1
l2: Power phase 2
l3: Power phase 3

@gjong Is it possible to add this to the integration?

The main issue here is that there seems to be no good way to detect the firmware version of a LS120. I am assuming the /d endpoint still only contains the model and mac data.

The only way I see right now to try and figure out the firmware version would be to scrape it of the /H endpoint, but that is finicky and could potentially break as soon as Youless changes the page layout.

Keep in mind that even if we are able to detect the firmware version correctly the output is completely different from the current output. This would require extensive work in both the python module and the integration in Home Assistant.

Yes, correct the output of the /d endpoint still only model and mac. Have you ever tried to request to future to show the current firmware version?

I’m currently working to get the data from the /f page in to HA with node-red ⇾ MQTT ⇾ HA MQTT auto discovery. Got it working, only Youless needs to kill a bug with my smart meter and the new firmware so i’m currently back to the old Youless firmware for now.

@gjong Today in the new firmware 1.5.3 the firmware version is available at the /d endpoint as you’ve requested :wink:.

Hopefully you have some time to look in to it.

Thanks in advance.

It would be great if you could post examples of the new output of the /d end-point. I’m still running on the very old 1.4.x version of the firmware and am not yet ready to update my device.

I will look into adding some additional logic, but the update of the python module will probably be a lot easier then a non breaking update of the home assistant component. So this will take some puzzling and time I’m afraid.

{“model”:“LS120”,“fw”:“1.5.3-EL”,“mac”:“72:b8:ad:14:39:7f”}

afbeelding

@gjong Updating the firmware is now very easy with the Android or iOS Youless app. You don’t need a Windows pc anymore.

Adding in my line…

{“model”:“LS120”,“fw”:“1.5.3-PO”,“mac”:“72:b8:ad:14:2b:3f”}

And indeed, upgrading is now easy with their app. Since i don’t have windows here.

I’ve started work for this in the python module under [YA-14] - Add support for the new phase information in firmware 1.5.x. I need to validate if this works properly before releasing the python module,

Once the module is released the integration work in home assistant can start for exposing the new data.

3 Likes

For those too exited to wait, who have the new firmware and and who have not set a password to access their Youless: You can place this in you sensors.yaml file. Don’t forget to put in the right IP adress for the resource parameter:

- platform: rest
  name: Youless phases
  scan_interval: 12
  resource: http://192.168.1.123/f
  headers:
    User-Agent: Home Assistant
    Content-Type: application/json
  method: GET
  json_attributes:
    - tr
    - i1
    - i2
    - i3
    - v1
    - v2
    - v3
    - l1
    - l2
    - l3
  value_template: "OK"
- platform: template
  sensors:
    youless_tariff:
      availability_template: "{{ state_attr('sensor.youless_phases', 'tr') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "tr") }}'
      unique_id: sensor.youless_tariff
      friendly_name: "Youless tariff"
    phase_1_current:
      availability_template: "{{ state_attr('sensor.youless_phases', 'i1') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "i1") | float(0) }}'
      unique_id: sensor.phase_1_current
      friendly_name: "Phase 1 current"
      unit_of_measurement: "A"
      device_class: "current"
    phase_1_voltage:
      availability_template: "{{ state_attr('sensor.youless_phases', 'v1') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "v1") | float(0) }}'
      friendly_name: "Phase 1 voltage"
      unique_id: sensor.phase_1_voltage
      unit_of_measurement: "V"
      device_class: "voltage"
    phase_1_power:
      availability_template: "{{ state_attr('sensor.youless_phases', 'l1') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "l1") | float(0) }}'
      friendly_name: "Phase 1 power"
      unique_id: sensor.phase_1_power
      unit_of_measurement: "W"
      device_class: "power"
    phase_2_current:
      availability_template: "{{ state_attr('sensor.youless_phases', 'i2') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "i2") | float(0) }}'
      friendly_name: "Phase 2 current"
      unique_id: sensor.phase_2_current
      unit_of_measurement: "A"
      device_class: "current"
    phase_2_voltage:
      availability_template: "{{ state_attr('sensor.youless_phases', 'v2') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "v2") | float(0) }}'
      friendly_name: "Phase 2 voltage"
      unique_id: sensor.phase_2_voltage
      unit_of_measurement: "V"
      device_class: "voltage"
    phase_2_power:
      availability_template: "{{ state_attr('sensor.youless_phases', 'l2') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "l2") | float(0) }}'
      friendly_name: "Phase 2 power"
      unique_id: sensor.phase_2_power
      unit_of_measurement: "W"
      device_class: "power"
    phase_3_current:
      availability_template: "{{ state_attr('sensor.youless_phases', 'i3') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "i3") | float(0) }}'
      friendly_name: "Phase 3 current"
      unit_of_measurement: "A"
      unique_id: sensor.phase_3_current
      device_class: "current"
    phase_3_voltage:
      availability_template: "{{ state_attr('sensor.youless_phases', 'v3') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "v3") | float(0) }}'
      friendly_name: "Phase 3 voltage"
      unique_id: sensor.phase_3_voltage
      unit_of_measurement: "V"
      device_class: "voltage"
    phase_3_power:
      availability_template: "{{ state_attr('sensor.youless_phases', 'l3') != 'unavailable' }}"
      value_template: '{{ state_attr("sensor.youless_phases", "l3") | float(0) }}'
      friendly_name: "Phase 3 power"
      unique_id: sensor.phase_3_power
      unit_of_measurement: "W"
      device_class: "power"
- platform: integration
  source: sensor.phase_1_power
  name: Phase 1 usage
  unique_id: sensor.phase_1_power
  unit_time: h
  unit_prefix: k
  round: 1
- platform: integration
  source: sensor.phase_2_power
  name: Phase 2 usage
  unique_id: sensor.phase_2_power
  unit_prefix: k
  unit_time: h
  round: 1
- platform: integration
  source: sensor.phase_3_power
  name: Phase 3 usage
  unique_id: sensor.phase_3_power
  unit_prefix: k
  unit_time: h
  round: 1  

It is quite likely this can be adjusted to accommodate a password protected Youless too, but I have not tested that.

nice one, lets hope we can get the rest in the integration soon. Always good to know how much power you pull over 1 fase to balance it better. Would not be the first time i blow a fuse :wink:

@gjong Add phase information to YouLess by gjong · Pull Request #89255 · home-assistant/core · GitHub, thanks for that. On my wish list :slight_smile:

I’m thankfull you added the phase infop to the youless integration. The json did however hold one other field, namely the tariff (high/low tariff) that you did not include. Is it possible to add that too? I now have my own rest sensor to add it. But I’m a bit worried it interferes with normal operation, as I now seem to have intermittent problems with getting the data from the youless, requiring me to power down the youless.

I use the tariff in some utility meters to switch tariffs, and for automations to start charging my car when the tariff is low.

Sorry for the late reply. I did not get notified when you replied in this thread.

I’ve added the current tariff in the API today Release 2.1.0 · gjong/youless-python-bridge (github.com). This release also includes the exposing of the firmware version of LS120.

This has been published to Pypi and can be integrated into the home assistant integration.

1 Like

That is great news! Thanks!