bramstroker / homeassistant-powercalc

Custom component to calculate estimated power consumption of lights and other appliances
MIT License
904 stars 249 forks source link

Unable to add Genio downlights, but could do so before #2036

Closed noob4722019 closed 4 months ago

noob4722019 commented 5 months ago

System Health details

System Information

version core-2024.2.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.1.74-haos
arch x86_64
timezone Australia/Sydney
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4874 Installed Version | 1.34.0 Stage | running Available Repositories | 1452 Downloaded Repositories | 13
AccuWeather can_reach_server | ok -- | -- remaining_requests | 43
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 11.5 -- | -- update_channel | stable supervisor_version | supervisor-2024.01.1 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 70.2 GB disk_used | 38.3 GB healthy | true supported | true board | ova supervisor_api | ok version_api | ok installed_addons | Samba share (12.2.0), Check Home Assistant configuration (3.11.0), File editor (5.7.0), Mosquitto broker (6.4.0), Advanced SSH & Web Terminal (17.1.0), Log Viewer (0.17.0), Network UPS Tools (0.13.0), TasmoAdmin (0.29.1), AppDaemon (0.16.4), Zigbee2MQTT (1.35.3-1), Home Assistant Google Drive Backup (0.112.1), Glances (0.21.0), Cloudflared (5.1.2), Actron Que/Neo Air Conditioner (2023.12.1), ESPHome (2023.12.9)
Dashboards dashboards | 5 -- | -- resources | 7 views | 25 mode | storage
Recorder oldest_recorder_run | February 3, 2024 at 10:05 AM -- | -- current_recorder_run | February 9, 2024 at 9:36 PM estimated_db_size | 6495.00 MiB database_engine | sqlite database_version | 3.44.2
Xiaomi Miot Auto component_version | 0.7.15 -- | -- can_reach_server | ok can_reach_spec | pending logged_accounts | 1 total_devices | 4

Checklist

Describe the issue

Unable to add Genio I004544 lights, although it worked be fore. Here's the error from debug.

2024-02-09 22:00:29.216 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp

Reproduction steps

  1. Installed PowerCalc for the first time
  2. Added integration
  3. Added grouped Genio I004544 downlights via Library. Group consists of 3x lights. Light group works fine.
  4. Lights successfully added, but the new sensors remained in an Unknown state, despite the lights working, I had toggled the lights on and off, to no avail
  5. I removed the lights, with the intention to-readd them
  6. Re-adding lights then failed with error message "2024-02-09 22:00:29.216 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp"
  7. I removed all PowerCalc devices (which were working, and autodiscovered devices)
  8. Uninstalled PowerCalc
  9. Re-installed PowerCalc
  10. Problem persists, still unable to add I004544 lights via templates
  11. Upgrading HA from 2024.1 to 2024.2 has not had an impact

Debug logs

2024-02-09 22:00:22.838 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: hs
2024-02-09 22:00:24.235 INFO (MainThread) [homeassistant.components.automation.update_androidtv] Poll Update AndroidTV shield: Running automation actions
2024-02-09 22:00:24.236 INFO (MainThread) [homeassistant.components.automation.update_androidtv] Poll Update AndroidTV shield: Executing step call service
2024-02-09 22:00:24.237 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity media_player.android_tv_192_168_1_254 not found.
2024-02-09 22:00:24.378 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp
2024-02-09 22:00:25.400 INFO (MainThread) [homeassistant.components.automation.lock_doors_at_10pm] Lock doors at 10pm: If at step 3: Running automation actions
2024-02-09 22:00:25.400 INFO (MainThread) [homeassistant.components.automation.lock_doors_at_10pm] Lock doors at 10pm: If at step 3: Executing step call service
2024-02-09 22:00:25.407 ERROR (MainThread) [homeassistant.components.webostv.notify] TV unreachable
2024-02-09 22:00:25.408 INFO (MainThread) [homeassistant.components.automation.lock_doors_at_10pm] Lock doors at 10pm: If at step 3: Executing step call service
2024-02-09 22:00:25.948 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: hs
2024-02-09 22:00:26.235 INFO (MainThread) [homeassistant.components.automation.update_androidtv] Poll Update AndroidTV shield: Running automation actions
2024-02-09 22:00:26.236 INFO (MainThread) [homeassistant.components.automation.update_androidtv] Poll Update AndroidTV shield: Executing step call service
2024-02-09 22:00:26.236 WARNING (MainThread) [homeassistant.helpers.entity_component] Forced update failed. Entity media_player.android_tv_192_168_1_254 not found.
2024-02-09 22:00:27.539 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp

Diagnostics dump or YAML config

No response

bramstroker commented 5 months ago

I would suggest to enable debug mode first for the powercalc logs. That should hopefully give some more insights.

noob4722019 commented 5 months ago

I would suggest to enable debug mode first for the powercalc logs. That should hopefully give some more insights.

Thanks, I have, but the only debug output when attempting to add the lights is 2024-02-09 22:00:29.216 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp

bramstroker commented 5 months ago

Could you provide details / screenshots what you actually enter during the configuration wizard?

And when do you get this error exactly? By clicking "Submit", if so, one what step?

noob4722019 commented 5 months ago
  1. Go to Integrations > Add Integration > Powercalc > Setup another instance of Powercalc > Library
  2. From there I enter the details per image
  3. image
  4. image
  5. image
  6. Log will say 2024-02-10 22:57:29.868 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp immiediately upon selecting Model ID and clicking next, it won't proceed any further.
  7. The same occurs regardless of which Genio Model ID I select (IO4544 is correct). But when I installed the integration for the very first time, it partially worked, the wizard suceeded, devices were created, but the PowerCalc devices remained in an unknown state.
bramstroker commented 5 months ago

Thanks for the information.

the LUT file provided by powercalc are made for each of the supported color modes of the light. You can see that in the supported model listing, last column.

Screenshot 2024-02-10 at 14 52 16

Your light should have color_temp as supported color mode (you can verify that in developer tools), as it's a light which allows to control the color temperature. Could you share that information please from developer tools?

So it's expected you would get an error when selecting I002926, as that one has no LUT file for color_temp.

However you say you are getting the same error while selecting IO4544, which is strange and shouldn't happen.

Let's first see what color modes are actually supported by your light.

noob4722019 commented 5 months ago

Appreciate your help @bramstroker

Here's the output for light.office_lights (which is a group consisting of 3x IO4544 devices). This is the entity I attempted to add in the screnshots above.

min_color_temp_kelvin: 2702
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 370
effect_list: Beautiful, Leasure, Meeting, Night, Rainbow, Read, Shine, Soft
supported_color_modes: color_temp, hs
effect: null
color_mode: color_temp
brightness: 255
color_temp_kelvin: 3663
color_temp: 273
hs_color: 27.026, 41.343
rgb_color: 255, 197, 149
xy_color: 0.442, 0.371
entity_id: light.downlight_office_3, light.office_downlight_2, light.light_office_1
icon: mdi:lightbulb-group
friendly_name:  Office lights
supported_features: 4

Here's the output of light.office_downlight_2, which is an IO4544 device and part of the above group. Note, the same problem occurs when trying to add an individual device, like this one.

min_color_temp_kelvin: 2702
max_color_temp_kelvin: 6535
min_mireds: 153
max_mireds: 370
effect_list: Night, Read, Meeting, Leasure, Soft, Rainbow, Shine, Beautiful
supported_color_modes: color_temp, hs
effect: null
color_mode: color_temp
brightness: 255
color_temp_kelvin: 3663
color_temp: 273
hs_color: 27.026, 41.343
rgb_color: 255, 197, 149
xy_color: 0.442, 0.371
raw_state: true
friendly_name: Office downlight middle
supported_features: 23
bramstroker commented 5 months ago

I see the problem. Your light supports color_temp and hs. hs is the mode for when the light is in color control mode. And this is correct because the light is an RGBW light which also allows to control the color, not only the temperature. Upon setting up the sensor Powercalc validates if the is a measurements file (LUT file) for each of the available color modes of the light. However for this light there is only a file for color_temp provided by the contributor. So that's the actual problem, that not all the measurements are provided for this light to work correctly. This validation has been added later on, so that would be the reason you were able to set it up before. But as you experienced the power sensor will be unavailable when you change the color off the light, because there are measurements missing.

The error message you have is confusing because it's expected to be: No lookup file found for mode: hs And not: No lookup file found for mode: color_temp

You are sure you got this error when selecting I004544 and not another model?

Anyways to get this resolved there must be measurements provided for the hs mode. Are you able to do that, following procedures here? https://homeassistant-powercalc.readthedocs.io/en/latest/contributing/measure.html When you are unable to do that we can ask the original contributor off the linked PR to provide that.

noob4722019 commented 5 months ago

It looks like Genio develop two very similar devices under different model numbers. Both devices are 9W/750 Lumen RGBW, though I004544 has an IP rating and is sold in a bundle of four. I believe that I'm actually using I002741 which are sold individually and have no IP rating.

My misunderstanding on model numbers has likely lead you on here, so my apologies. I'm not sure where I can confirm my light device ID, but it's likely to be I002741 as Kmart (where I purchased mine) is the only distributor of them.

I002741 has no profile and I'm happy to try and create one. Do you know if either of the below are accurate enough for power measurement?

https://www.zigbee2mqtt.io/devices/TS011F_plug_1.html https://www.zigbee2mqtt.io/devices/ZNCZ02LM.html#xiaomi-zncz02lm

bramstroker commented 5 months ago

Not sure, you can at least try. Have a look if the power is slowly increasing, and no 0 readings on low brightness levels. When you see if gives no readings or unreliable readings you can abort the script. You could also use csvplot to visualize https://www.csvplot.com/

I have quickly digested a list with the used smart plugs for measurements:

Shelly Plug S: 92
Shelly 1PM: 41
TP-Link Tapo P110: 27
Zhurui PR10-D: 20
TP-Link Kasa HS110: 20
TP-Link Kasa KP115: 15
Shelly Plug: 10
Gosund SP111 on Tasmota 9.5.0: 10
Shelly Plus Plug S: 9
Shelly Plus 1PM: 9
Shelly, Plus1PM: 7
TP-Link Kasa KP115(US): 7
Tapo P110: 6
Sonoff S31: 5
Fibaro FGW102: 4
Shelly Plus Plug S / AVM FRITZ!DECT 200: 4
Shelly Plug US: 4
Nous A1T: 4
Sonoff S31 running Tasmota: 3
PeakTech P 4250 (1 mV/10 mA) with VOLTCRAFT VC270: 3
SONOFF S31: 3
Kasa KP115: 3
AVM FRITZ!DECT 200: 3
Gosuna Smart Plug UP111 (via tuya): 3
TP-Link Kasa KP125: 3
Nous A1 with TASMOTA 9.5.0: 3
TP-Link Smart Wi-Fi Plug Mini: 3
ZOOZ Z-WAVE PLUS S2 POWER STRIP ZEN20 VER. 3.0: 3
Shelly Plus 1 PM: 2
Gosund, UP111: 2
Fibaro FGWP102: 2
Athom Smart Plug v2: 2
Zhurui PR10: 2
unknown: 2
Meross mss315: 2
Kasa EP25: 2
RRPM02 (Model); 4897037690801 (Barcode); Reduction Revolution Plug-in Power Meter: 2
See linked profile: 2
HOPI HP-9800: 2
Shelly, 1PM: 2
Shelly 2 PM: 2
TP-Link Tapo P115: 2
Gosund, UP111 (ESPHome): 2
Zooz Z-Wave Plus Power Switch ZEN15: 1
Power-Mate Lite: 1
Sonoff DualR3: 1
NOUS A1T with ESPHome 2023.10.3: 1
NOUS A1T with ESPHome 2023.12.5: 1
TP-Link HS110: 1
Shelly 3EM: 1
NOUS A1T with ESPHome 2023.11.6: 1
Shelly PlusPlugS: 1
Tuya: 1
Centralite 3200-Sgb: 1
TP-Link, P110: 1
Aqara Smart Plug EU (SP-EUC01): 1
Wemo Insight F7C029uk: 1
Shelly Plug E: 1
Shelly, PlusPlugS: 1
GreenWave - GWPN1: 1
Brennenstuhl PM 231 E: 1
PZEM-004T: 1
Gosund SP1 Tasmota: 1
Gosund SP111 with Tasmota: 1
Shelly, Plug E (gen1): 1
NOUS A1Z: 1
Shelly 2.5: 1
P3 P4400 Kill A Watt Usage Monitor: 1
noob4722019 commented 4 months ago

Thanks so much for your help, and for this project @bramstroker - I've created a PR at https://github.com/bramstroker/homeassistant-powercalc/pull/2065

Update: I've uploaded color_temp.csv, hs.csv and model.json to homeassistant-powercalc/custom_components/powercalc/data/genio/I002741$ on my local install, and the new I002741 light now appears when attempting to add a virtual power (library) via the wizard. However, I'm still getting the below errors.

The UI error: image

Debug log error:

2024-02-23 23:56:58.364 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp
2024-02-23 23:56:58.542 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp
2024-02-23 23:56:58.715 ERROR (MainThread) [custom_components.powercalc.config_flow] No lookup file found for mode: color_temp

Contents of of light config directory image

bramstroker commented 4 months ago

You'll need to copy the gzipped files *.csv.gz. The normal csv files won't be loaded by powercalc loading logic.

noob4722019 commented 4 months ago

Hi @bramstroker , I've been trying to grab measurements using a more accurate Xiaomi Zigbee plug. This one is grabbing measurements to 2 decimals, however I'm running into the below.

2024-02-25 13:52:51,301 [INFO] Progress: 52%, Estimated time left: 1.8h
2024-02-25 13:52:51,301 [INFO] Changing light to: ColorTempVariation(bri=171, ct=283)
2024-02-25 13:53:57,347 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:53:57,347 [INFO] Changing light to: ColorTempVariation(bri=171, ct=293)
2024-02-25 13:55:03,392 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:55:03,393 [INFO] Changing light to: ColorTempVariation(bri=171, ct=303)
2024-02-25 13:56:09,443 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:56:09,443 [INFO] Changing light to: ColorTempVariation(bri=171, ct=313)
2024-02-25 13:57:15,486 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:57:15,486 [INFO] Changing light to: ColorTempVariation(bri=171, ct=323)
2024-02-25 13:58:21,537 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:58:21,537 [INFO] Changing light to: ColorTempVariation(bri=171, ct=333)
2024-02-25 13:59:27,590 [WARNING] Discarding measurement: 0 watt was read from the power meter
2024-02-25 13:59:27,590 [ERROR] Aborting measurement session. Received too many 0 readings
2024-02-25 13:59:27,598 [ERROR] Some error occurred during the measurement session
2024-02-25 13:59:27,602 [INFO] Measuring standby power. Waiting for 20 seconds...
2024-02-25 14:00:44,124 [ERROR] Measured 0 watt as standby usage, continuing now, but you probably need to have a look into measuring multiple lights at the same time or using a dummy load.
Traceback (most recent call last):
  File "/app/measure.py", line 333, in <module>
    main()
  File "/app/measure.py", line 325, in main
    measure.start()

My question is, is there a way to resume a measurement run from where it last failed? I noticed there's a resume flag in .env but not sure how to utilise it. And do you have any recommendations on how to manage 0 standby measurements? I've just some of the time values hoping that'll manage it. The standby power should be around 1.15W, based of the values I can see now on HA.

bramstroker commented 4 months ago

How does the measurements look before the 52%? You could visualize these in https://www.csvplot.com. Strange you are running into 0 readings in the middle of a measurements session. When you start the measurements again for same color mode it should automatically ask you the question if you want to resume. Make a backup of the files in advance just in case.

noob4722019 commented 4 months ago

Strange indeed. Here's the last 30 values before the 0 readings, it looks to be working fine.


nub@nubuntu-desktop:~/Documents/docker/powercalc-measure/export/I002741$ tail color_temp.csv  -n 30
156,253,7.56
156,263,7.56
156,273,7.68
156,283,7.68
156,293,7.68
156,303,7.68
156,313,7.68
156,323,7.68
156,333,7.68
156,343,7.68
156,353,7.68
156,363,7.68
156,370,7.68
161,153,7.68
161,163,7.68
161,173,7.68
161,213,7.68
161,223,7.68
161,233,7.68
161,243,7.68
161,253,7.68
161,263,7.68
161,273,7.68
161,283,7.56
161,293,7.56
161,303,7.56
161,313,7.56
161,323,7.56
161,333,7.56
161,343,7.68

Actually, it does continue.. I just misinterpreted the 0% status as being a complete reset. I've confirmed by checking that the re-runs successfully appended to the existing color_temp.csv


2024-02-26 11:28:52,661 [INFO] Resuming measurements
2024-02-26 11:28:52,664 [INFO] Starting measurements. Estimated duration: 3.5h
2024-02-26 11:28:52,664 [INFO] Start taking measurements for color mode: color_temp
2024-02-26 11:28:52,665 [INFO] Waiting 10 seconds...
2024-02-26 11:29:02,665 [INFO] Progress: 0%, Estimated time left: 3.5h
noob4722019 commented 4 months ago

I'll close this off as it'll be resolved in https://github.com/bramstroker/homeassistant-powercalc/pull/2065

Thanks for your help and patience.