bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

possibility to disable a supported_color_modes

erdnaxela02 opened this issue · comments

System Health details

System Information

version core-2024.3.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.1.73-haos-raspi
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 5000
Installed Version 1.34.0
Stage running
Available Repositories 1410
Downloaded Repositories 20
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 12.1
update_channel stable
supervisor_version supervisor-2024.03.0
agent_version 1.6.0
docker_version 24.0.7
disk_total 54.3 GB
disk_used 22.5 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons AdGuard Home (5.0.4), InfluxDB (5.0.0), Zigbee2MQTT (1.36.0-1), File editor (5.8.0), FTP (5.0.1), Duck DNS (1.15.0), Mosquitto broker (6.4.0), pigpio (1.5.2), Portainer (2.19.4-3), Samba Backup (5.2.0), Samba share (12.3.1), Terminal & SSH (9.10.0), Vaultwarden (Bitwarden) (0.21.1), WireGuard (0.10.2), Sharry-dependency-less (2.2.0)
Dashboards
dashboards 2
resources 11
views 6
mode storage
Recorder
oldest_recorder_run 9 mars 2024 à 14:45
current_recorder_run 18 mars 2024 à 14:13
estimated_db_size 1528.77 MiB
database_engine sqlite
database_version 3.44.2

Checklist

  • I have read the FAQ to see if there is a known solution to my problem.
  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of currently previous issues..

Describe the issue

Since a February 2024 update, HA forces the lights to set the color mode

https://developers.home-assistant.io/blog/2024/02/12/light-color-mode-mandatory/

Before this my mibedsidelamp2 had the supported_color_modes: hs attribute and worked fine.
Since then, my lamp with the supported_color_modes: color_temp, hs attribute and powercalc cannot create the energy sensor because no color_temp LUT is available in custom_components/powercalc/data/yeelight/YLDP13YL
My lamp works in color_mode: hs and never color_temp
Is there a possibility of disabling the search for color_temp.csv.gz by PowerCalc so that it only searches for hs.csv.gz?
Is it possible to disable it in custom_components/powercalc/data/yeelight/YLDP13YL/model.json with a parameter for example "use_only": "hs" ?
Or in the sensor configuration with a param in configuration.yaml ?

Reproduction steps

  1. connect MJCTD02YL with HomeKit
  2. let powercalc automatically discover
  3. restart Home Assistant

Debug logs

2024-03-19 12:55:58.570 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=light.mibedsidelamp2_9502 entity_category=None, sensor_name=MiBedsideLamp2-9502 power strategy=lut manufacturer=yeelight model=MJCTD02YL unique_id=pc_0B:99:5D:58:2A:6B_1_11)
2024-03-19 12:55:58.570 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] Loading LUT data file: /config/custom_components/powercalc/power_profile/../data/yeelight/MJCTD02YL/hs.csv.gz
2024-03-19 12:55:58.587 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] LUT file loaded: 2025 lines
2024-03-19 12:55:58.588 ERROR (MainThread) [custom_components.powercalc.sensors.power] light.mibedsidelamp2_9502: Skipping sensor setup: No lookup file found for mode: color_temp
2024-03-19 12:55:58.589 ERROR (MainThread) [custom_components.powercalc.sensor] No energy sensor created for config_entry 7226e77252a096907b87cab7dd88b0d7

Diagnostics dump or YAML config

not available since the sensor is not created

I'm working on it. I have a version that works by adding the disabled_color_mode parameter in the sensor configuration.
Only I'm not a developer at all. I learned a lot about python while working on this. I've been testing for two days. And it seems to work but I was only able to test it with my lamp. I imagine that it takes a whole series of tests to offer you the fruit of this work and to be validated?

**Note; I think I should work on adding this new function in the GUI interface

@erdnaxela02
I'm sorry to say, but I don't like to include this kind of option. It is trying to solve a problem which shouldn't be there in the first place
Powercalc should just provide a LUT file for all the possible color_modes of the light, when it doesn't things will also break for other users setting up the light from the library.

I guess the model you referenced in your comment (YLDP13YL) is not the right one, as this one has both an hs and color_temp.csv.

From your debug logs it's about the bedside lamp MJCTD02YL.
That one currently only has a hs.csv, so indeed will break when HA reports it also supports color_temp.csv

Screenshot 2024-03-22 at 08 05 58

Does it actually work when you set it on color_temp mode, or is this a bug in Yeelight integration?
When it works than we'll have to add a color_temp.csv to make sure the powercalc sensor works correctly for users putting the light in color_temp mode.
When you are able to would be very nice if you can provide the measurements: https://homeassistant-powercalc.readthedocs.io/en/latest/contributing/measure.html.

When you can't you could solve the problem for your specific installation as follows.
Copy the YLDP13YL directory to config/powercalc-custom-models/yeelight directory. and add a color_temp.csv.gz there. Just copy one from another directory.
Powercalc checks config/powercalc-custom-models first before the built-in directory, so that would also solve your issue.

@erdnaxela02 I'm sorry to say, but I don't like to include this kind of option.

Okay okay I completely understand no worries

I guess the model you referenced in your comment (YLDP13YL) is not the right one, as this one has both an hs and color_temp.csv.

Yes I'm sorry it's a copy/paste error on my part

When you are able to would be very nice if you can provide the measurements

This is not possible, I do not have the necessary equipment to carry out measurements. If anyone from the community has the opportunity to do it one day, that would be great :)

Just copy one from another directory

Well I think that will be my solution until someone can take the measurements. A quick and easy workaround for once :)

Thank you for taking the time and attention to my concerns.
I close this issue since it works by copying color_temp.csv.gz from another directory :)

This is not possible, I do not have the necessary equipment to carry out measurements. If anyone from the community has the opportunity to do it one day, that would be great :)

You'll only need a smartplug with power measurement to do it, and run the script which will take few hours max to finish.
For example Shelly Plug S, and Tapo P100 are used a lot. But other smartplugs can work as well.