Closed Reynders1 closed 2 years ago
Please check the logs for errors.
Should be supported, see https://github.com/bramstroker/homeassistant-powercalc/blob/master/docs/supported_models.md#Smart-switches.
It will create a power sensor for tracking the device self usage, which is 0.52 watt.
Oops, I overlooked it... Here is the log: `This error originated from a custom integration.
Logger: aiohttp.server Source: custom_components/powercalc/strategy/factory.py:52 Integration: Powercalc (documentation, issues) First occurred: 11:25:28 (1 occurrences) Last logged: 11:25:28
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper result = await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 280, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/powercalc/config_flow.py", line 441, in async_step_lut_model errors = await self.validate_strategy_config() File "/config/custom_components/powercalc/config_flow.py", line 494, in validate_strategy_config strategy = await _create_strategy_object( File "/config/custom_components/powercalc/config_flow.py", line 640, in _create_strategy_object return factory.create(config, strategy, power_profile, source_entity) File "/config/custom_components/powercalc/strategy/factory.py", line 52, in create raise UnsupportedMode("Invalid calculation mode", strategy) custom_components.powercalc.errors.UnsupportedMode: ('Invalid calculation mode', None) `
Did you select a manufacturer / model manually or just accepted and submitted what was already detected?
I had to select everything manually: manufacturer and model.
Very strange. On the discovered entities you should not have to select manufacturer and model manually. What is the screen you get when you click "Configure" on one of the discovered entities? Do you have a screenshot of that?
Here it is. ANd this is the same for the model.
Hmm ok, that's strange will see if I can reproduce. So this is directly after clicking "Configure" or did you walk through the config flow previously and aborted halfway?
No. I did ran the config flow until i got the error message. I tried it with the for devices identified. I also rebooted HA a couple of time. The devices were each time identified.
Christian Reynders On 3. Nov 2022 at 13:00 +0100, Bram Gerritsen @.***>, wrote:
Hmm ok, that's strange will see if I can reproduce. So this is directly after clicking "Configure" or did you walk through the config flow previously and aborted halfway? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
So you didn't got a screen like this first time after clicking the discovered entry?
I got it a few days ago when I installed Powercalc. It discovered 4 lamps and the configuration went fine. On that day, it didn’t identified the shelly plugs.
Christian On 3. Nov 2022 at 20:48 +0100, Bram Gerritsen @.***>, wrote:
So you didn't got a screen like this first time after clicking the discovered entry? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Are you able to sent me the contents of config/.storage/core.config_entries
? You can sent to bgerritsen at gmail dot com
with v1.0.2 I have implemented the option to download diagnostics. When you click the three dots on the config entry you have troubles with you should have the option to download. You can include the report here as it shouldn't contain any sensitive information.
I installed v1.0.2, but the option to download the diagnostic is not available for those shelly plugs. I downloaded the one of a successful device and manually added the data for all the shelly plugs. I hope you have all you need. I can't send you the core.config_entries file as such as is contains passwords (an many other sensitive data) in clear. If you need it, I will have to go through the 1000+ line and anonymize it.
config_entry-powercalc-5a3ebbfa4dc72196268376bb19b737a8.json.txt
You'll only have the download diagnostics option for powercalc config entries, not on the Shelly plugs (as these are provided by the Shelly integration).
The problem is with the powercalc config entries, you can search these in core.config_entries "domain": "powercalc"
, you should be able to find the 4 discovered ones here as well, but you should also be able to click the three dots on the discovered and click "Download diagnostics".
Here are the diagnostics for the 4 successfully configured lamps. Nothing else availble for the plugs as the config flow failed. config_entry-powercalc-1b6e2c43af9a77c4b38a956e5b0e980b.json.txt config_entry-powercalc-ba5ba766f7b4850871571b2e1887b4d4.json.txt config_entry-powercalc-da34fbefdf4fedbd40c5c2537cb81444.json.txt config_entry-powercalc-5a3ebbfa4dc72196268376bb19b737a8.json.txt _config_entry-powercalc-5a3ebbfa4dc72196268376bb19b737a8.json.txt
Hmm, the lamps won't help at all as these are configured successfully. You are right, there is no option to download diagnostics for the discovered config entries. Also it's not in core.config_entries yet as only finished config flows which have created an config entry will be there.
Need to think about how to get the information somehow. I think I might add some debug logging.
OK. Is there a debug option that I could activate to get more info?
Christian Reynders On 4. Nov 2022 at 10:07 +0100, Bram Gerritsen @.***>, wrote:
Hmm, the lamps won't help at all as these are configured successfully. You are right, there is no option to download diagnostics for the discovered config entries. Also it's not in core.config_entries yet as only finished config flows which have created an config entry will be there. Need to think about how to get the information somehow. I think I might add some debug logging. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Btw are you able to do a quick test by upgrading to v1.0.2 as also some logic has been changed regarding the library flow (choosing manufacturer / model etc.)?
I did it already. All diagnostics I sent you are generated with that version. I also tried to configure the plugs; nothing changed.
Christian Reynders On 4. Nov 2022 at 10:10 +0100, Bram Gerritsen @.***>, wrote:
Btw are you able to do a quick test by upgrading to v1.0.2 as also some logic has been changed regarding the library flow (choosing manufacturer / model etc.)? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
OK. Is there a debug option that I could activate to get more info? Christian Reynders
There is a debug option where you can get verbose logging for powercalc. Add following to your configuration.yaml
logger:
default: warning
logs:
custom_components.powercalc: debug
However, I will need to add some logging at a certain point in the code for the discovery flow. But need to think about which information I need to debug and resolve the issue. Will let you know if I added extra logging and you can enable it.
Ok. Thanks
Christian Reynders On 4. Nov 2022 at 10:13 +0100, Bram Gerritsen @.***>, wrote:
OK. Is there a debug option that I could activate to get more info? Christian Reynders There is a debug option where you can get verbose logging for powercalc. Add following to your configuration.yaml logger: default: warning logs: custom_components.powercalc: debug However, I will need to add some logging at a certain point in the code for the discovery flow. But need to think about which information I need to debug and resolve the issue. Will let you know if I added extra logging and you can enable it. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
I have added some extra logging. Can you install the master branch with HACS (redownload option).
You should see something like this in the log after you click "Configure".
DEBUG (MainThread) [custom_components.powercalc.config_flow] Starting discovery flow: {'unique_id': '8804ff10-96c7-44cc-baf4-27093c9813d0', 'name': 'Ambient muur', 'entity_id': 'light.ambient_muur', 'manufacturer': 'signify', 'model': 'LCT024'}
Please also share screenshot(s) of the screens you got after clicking "Configure".
I redownloaded and am still with v1.0.2.
confiuration.yaml contains:
logger: default: warning logs: custom_components.powercalc: debug
Nothing about DEBUG in the log. I restarted HA twice! `This error originated from a custom integration.
Logger: aiohttp.server Source: custom_components/powercalc/strategy/factory.py:52 Integration: Powercalc (documentation, issues) First occurred: 11:19:44 (5 occurrences) Last logged: 11:24:02
Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle resp = await handler(request) File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle result = await result File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 180, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper result = await method(view, request, data, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 280, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/powercalc/config_flow.py", line 442, in async_step_model errors = await self.validate_strategy_config() File "/config/custom_components/powercalc/config_flow.py", line 495, in validate_strategy_config strategy = await _create_strategy_object( File "/config/custom_components/powercalc/config_flow.py", line 641, in _create_strategy_object return factory.create(config, strategy, power_profile, source_entity) File "/config/custom_components/powercalc/strategy/factory.py", line 52, in create raise UnsupportedMode("Invalid calculation mode", strategy) custom_components.powercalc.errors.UnsupportedMode: ('Invalid calculation mode', None) ` Screenshot attached.
Could you check if you have this line https://github.com/bramstroker/homeassistant-powercalc/blob/master/custom_components/powercalc/config_flow.py#L218? Just to be sure you are on latest master branch.
In config/custom_components/powercalc/config_flow.py
(line 218)
No. It is not there!
The version I have in HACS is the following:
Make sure you have selected master here, not v1.0.2
Oops... Info from HACS:
and the log with search keyword "powercalc": log.txt
Thanks. Will have a look later today / tomorrow. Might be I need to add some more debug logging.
Ok. Thanks again.
Could you try overwriting the powercalc source code with the code in the zip file? I have added some more debug logs there.
Here is the new log. I ran it for the device “switch.prise_multimedia"
Christian On 4. Nov 2022 at 14:13 +0100, Bram Gerritsen @.***>, wrote:
Could you try overwriting the powercalc source code with the code in the zip file? I have added some more debug logs there. powercalc.zip — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>
Full logs
2022-11-04 14:21:52.662 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration powercalc which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-11-04 14:22:37.042 DEBUG (MainThread) [custom_components.powercalc] Start auto discovering entities 2022-11-04 14:22:37.043 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.lampe_bureau_grenier: Auto discovered model (manufacturer=OSRAM, model=4052899926110) 2022-11-04 14:22:37.048 DEBUG (MainThread) [custom_components.powercalc] light.lampe_bureau_grenier: Already setup with discovery, skipping new discovery 2022-11-04 14:22:37.048 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.lampe_buffet: Auto discovered model (manufacturer=Signify Netherlands B.V., model=929002241201) 2022-11-04 14:22:37.071 DEBUG (MainThread) [custom_components.powercalc] light.lampe_buffet: Already setup with discovery, skipping new discovery 2022-11-04 14:22:37.071 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.schedule_plan_salon: Auto discovered model @., model=Scheduler) 2022-11-04 14:22:37.072 DEBUG (MainThread) [custom_components.powercalc] switch.schedule_plan_salon: Model not found in library, skipping discovery 2022-11-04 14:22:37.072 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.schedule_plan_salle_a_manger: Auto discovered model @., model=Scheduler) 2022-11-04 14:22:37.072 DEBUG (MainThread) [custom_components.powercalc] switch.schedule_plan_salle_a_manger: Model not found in library, skipping discovery 2022-11-04 14:22:37.072 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.lampe_salon: Auto discovered model (manufacturer=HORNBACH, model=10011725) 2022-11-04 14:22:37.073 DEBUG (MainThread) [custom_components.powercalc] light.lampe_salon: Model not found in library, skipping discovery 2022-11-04 14:22:37.074 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] media_player.apple_tv: Auto discovered model (manufacturer=Apple, model=Apple TV 4K) 2022-11-04 14:22:37.074 DEBUG (MainThread) [custom_components.powercalc] media_player.apple_tv: Model not found in library, skipping discovery 2022-11-04 14:22:37.075 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.lampe_lit_christian: Auto discovered model (manufacturer=IKEA of Sweden, model=LED1923R5) 2022-11-04 14:22:37.097 DEBUG (MainThread) [custom_components.powercalc] light.lampe_lit_christian: Already setup with discovery, skipping new discovery 2022-11-04 14:22:37.098 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.lampe_lit_gene: Auto discovered model (manufacturer=IKEA of Sweden, model=LED1923R5) 2022-11-04 14:22:37.098 DEBUG (MainThread) [custom_components.powercalc] light.lampe_lit_gene: Already setup with discovery, skipping new discovery 2022-11-04 14:22:37.099 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_grenier_relay_0: Auto discovered model (manufacturer=Shelly, model=Shelly Plug S) 2022-11-04 14:22:37.101 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_grenier: Auto discovered model (manufacturer=Shelly, model=Shelly Plug S) 2022-11-04 14:22:37.103 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_salon: Auto discovered model (manufacturer=Shelly, model=Shelly Plug S) 2022-11-04 14:22:37.104 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] media_player.ue40d7000: Auto discovered model (manufacturer=Samsung Electronics, model=UE40D7000) 2022-11-04 14:22:37.105 DEBUG (MainThread) [custom_components.powercalc] media_player.ue40d7000: Model not found in library, skipping discovery 2022-11-04 14:22:37.106 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] media_player.spotify: Auto discovered model (manufacturer=Spotify AB, model=Spotify premium) 2022-11-04 14:22:37.107 DEBUG (MainThread) [custom_components.powercalc] media_player.spotify: Model not found in library, skipping discovery 2022-11-04 14:22:37.107 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.schedule_plan_cuisine: Auto discovered model @., model=Scheduler) 2022-11-04 14:22:37.108 DEBUG (MainThread) [custom_components.powercalc] switch.schedule_plan_cuisine: Model not found in library, skipping discovery 2022-11-04 14:22:37.108 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.browser_mod_mbp_christian_screen: Auto discovered model (manufacturer=Browser Mod, model=None) 2022-11-04 14:22:37.108 DEBUG (MainThread) [custom_components.powercalc] light.browser_mod_mbp_christian_screen: Model not found in library, skipping discovery 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] media_player.browser_mod_mbp_christian: Auto discovered model (manufacturer=Browser Mod, model=None) 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc] media_player.browser_mod_mbp_christian: Model not found in library, skipping discovery 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] light.browser_mod_iphone_christian_screen: Auto discovered model (manufacturer=Browser Mod, model=None) 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc] light.browser_mod_iphone_christian_screen: Model not found in library, skipping discovery 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] media_player.browser_mod_iphone_christian: Auto discovered model (manufacturer=Browser Mod, model=None) 2022-11-04 14:22:37.109 DEBUG (MainThread) [custom_components.powercalc] media_player.browser_mod_iphone_christian: Model not found in library, skipping discovery 2022-11-04 14:22:37.110 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.schedule_plan_sdb: Auto discovered model @., model=Scheduler) 2022-11-04 14:22:37.110 DEBUG (MainThread) [custom_components.powercalc] switch.schedule_plan_sdb: Model not found in library, skipping discovery 2022-11-04 14:22:37.110 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_multimedia: Auto discovered model (manufacturer=Shelly, model=Shelly Plug S) 2022-11-04 14:22:37.112 DEBUG (MainThread) [custom_components.powercalc] Done auto discovering entities 2022-11-04 14:22:37.358 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.prise_grenier_relay_0 entity_category=None, sensor_name=Prise grenier Relay 0 Device Power strategy=FixedStrategy manufacturer=shelly model=shelly plug s standby_power=0.52 unique_id=shellyplug-s-ddc461-relay-0) 2022-11-04 14:22:37.359 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Prise grenier Relay 0 Device Energy 2022-11-04 14:22:37.360 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.prise_grenier entity_category=None, sensor_name=Prise grenier Device Power strategy=FixedStrategy manufacturer=shelly model=shelly plug s standby_power=0.52 unique_id=3C6105DDC461-relay_0) 2022-11-04 14:22:37.360 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Prise grenier Device Energy 2022-11-04 14:22:37.361 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.prise_salon entity_category=None, sensor_name=Prise salon Device Power strategy=FixedStrategy manufacturer=shelly model=shelly plug s standby_power=0.52 unique_id=3C6105EF7213-relay_0) 2022-11-04 14:22:37.361 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Prise salon Device Energy 2022-11-04 14:22:37.361 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=switch.prise_multimedia entity_category=None, sensor_name=Prise multimedia Device Power strategy=FixedStrategy manufacturer=shelly model=shelly plug s standby_power=0.52 unique_id=4022D880DBE9-relay_0) 2022-11-04 14:22:37.362 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Prise multimedia Device Energy 2022-11-04 14:22:37.362 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] Loading LUT data file: /config/custom_components/powercalc/power_profile/../data/ikea/LED1923R5/color_temp.csv.gz 2022-11-04 14:22:37.376 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] LUT file loaded: 1144 lines 2022-11-04 14:22:37.378 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=light.lampe_lit_gene entity_category=None, sensor_name=Lampe lit Gene power strategy=LutStrategy manufacturer=ikea model=LED1923R5 standby_power=0.18 unique_id=0xb4e3f9fffed8727c_light_zigbee2mqtt) 2022-11-04 14:22:37.379 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Lampe lit Gene energy 2022-11-04 14:22:37.380 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=light.lampe_lit_christian entity_category=None, sensor_name=Lampe lit Christian power strategy=LutStrategy manufacturer=ikea model=LED1923R5 standby_power=0.18 unique_id=0x50325ffffec96fa9_light_zigbee2mqtt) 2022-11-04 14:22:37.380 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Lampe lit Christian energy 2022-11-04 14:22:37.382 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] Loading LUT data file: /config/custom_components/powercalc/power_profile/../data/signify/LWV001/brightness.csv.gz 2022-11-04 14:22:37.386 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] LUT file loaded: 255 lines 2022-11-04 14:22:37.386 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=light.lampe_buffet entity_category=None, sensor_name=Lampe buffet power strategy=LutStrategy manufacturer=signify model=LWV001 standby_power=0.50 unique_id=0x0017880108a03513_light_zigbee2mqtt) 2022-11-04 14:22:37.387 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Lampe buffet energy 2022-11-04 14:22:37.388 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] Loading LUT data file: /config/custom_components/powercalc/power_profile/../data/osram/LIGHTIFY Indoor Flex RGBW/color_temp.csv.gz 2022-11-04 14:22:37.405 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] LUT file loaded: 1872 lines 2022-11-04 14:22:37.406 DEBUG (MainThread) [custom_components.powercalc.sensors.power] Creating power sensor (entity_id=light.lampe_bureau_grenier entity_category=None, sensor_name=Lampe bureau grenier power strategy=LutStrategy manufacturer=osram model=LIGHTIFY Indoor Flex RGBW standby_power=0.30 unique_id=0x7cb03eaa0a008ec1_light_zigbee2mqtt) 2022-11-04 14:22:37.406 DEBUG (MainThread) [custom_components.powercalc.sensors.energy] Creating energy sensor: Lampe bureau grenier energy 2022-11-04 14:22:37.443 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_grenier_relay_0_device_power to device 589cb1c0be01060b950f5a776139553f 2022-11-04 14:22:37.446 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_grenier_device_power to device 589cb1c0be01060b950f5a776139553f 2022-11-04 14:22:37.453 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_multimedia_device_power to device cc8d04cd32a268f181a0ca2f2238cf0d 2022-11-04 14:22:37.457 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_lit_gene_power to device df54e200d333f88e5aa956cfa13bd40a 2022-11-04 14:22:37.460 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_lit_christian_power to device 9552585ee5d8e94bd3522928d8cf9f92 2022-11-04 14:22:37.464 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_buffet_power to device 3359e5a9b24317951073d7ecda484560 2022-11-04 14:22:37.467 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_bureau_grenier_power to device c19730f5efb696d5bfad1902ae65ca28 2022-11-04 14:22:37.716 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_grenier_relay_0_device_energy to device 589cb1c0be01060b950f5a776139553f 2022-11-04 14:22:37.718 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_grenier_device_energy to device 589cb1c0be01060b950f5a776139553f 2022-11-04 14:22:37.720 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_salon_device_energy to device 00dcab249f9a1dade0b3589da15c7e52 2022-11-04 14:22:37.721 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.prise_multimedia_device_energy to device cc8d04cd32a268f181a0ca2f2238cf0d 2022-11-04 14:22:37.724 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_lit_gene_energy to device df54e200d333f88e5aa956cfa13bd40a 2022-11-04 14:22:37.725 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_lit_christian_energy to device 9552585ee5d8e94bd3522928d8cf9f92 2022-11-04 14:22:37.727 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_buffet_energy to device 3359e5a9b24317951073d7ecda484560 2022-11-04 14:22:37.729 DEBUG (MainThread) [custom_components.powercalc.sensors.abstract] Binding sensor.lampe_bureau_grenier_energy to device c19730f5efb696d5bfad1902ae65ca28 2022-11-04 14:22:42.575 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_lit_gene: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:22:42.576 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_lit_christian: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:22:42.576 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_buffet: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:22:42.577 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_bureau_grenier: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:22:43.537 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.prise_grenier_relay_0: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:22:43.861 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_buffet: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:27.968 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.prise_grenier_relay_0: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:27.969 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.prise_grenier: State changed to "off". Power:0.52 2022-11-04 14:25:27.969 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.prise_multimedia: State changed to "on". Power:0.82 2022-11-04 14:25:27.970 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_lit_gene: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:27.970 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_lit_christian: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:27.971 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_buffet: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:27.972 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_bureau_grenier: Source entity has an invalid state, setting power sensor to unavailable 2022-11-04 14:25:38.963 DEBUG (MainThread) [custom_components.powercalc.sensors.power] switch.prise_grenier_relay_0: State changed to "off". Power:0.52 2022-11-04 14:25:40.879 DEBUG (MainThread) [custom_components.powercalc.config_flow] Starting discovery flow: {'unique_id': 'shellyplug-s-ddc461-relay-0', 'name': 'Prise grenier Relay 0', 'entity_id': 'switch.prise_grenier_relay_0', 'manufacturer': 'shelly', 'model': 'shelly plug s'} 2022-11-04 14:25:40.880 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_grenier_relay_0: Auto discovered model (manufacturer=Allterco Robotics, model=Shelly Plug S) 2022-11-04 14:25:40.881 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 3 2022-11-04 14:25:40.883 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 4 2022-11-04 14:25:40.918 DEBUG (MainThread) [custom_components.powercalc.config_flow] Starting discovery flow: {'unique_id': '3C6105DDC461-relay_0', 'name': 'Prise grenier', 'entity_id': 'switch.prise_grenier', 'manufacturer': 'shelly', 'model': 'shelly plug s'} 2022-11-04 14:25:40.919 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_grenier: Auto discovered model (manufacturer=Allterco Robotics, model=Shelly Plug S) 2022-11-04 14:25:40.919 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 3 2022-11-04 14:25:40.919 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 4 2022-11-04 14:25:40.970 DEBUG (MainThread) [custom_components.powercalc.config_flow] Starting discovery flow: {'unique_id': '3C6105EF7213-relay_0', 'name': 'Prise salon', 'entity_id': 'switch.prise_salon', 'manufacturer': 'shelly', 'model': 'shelly plug s'} 2022-11-04 14:25:40.971 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_salon: Auto discovered model (manufacturer=Allterco Robotics, model=Shelly Plug S) 2022-11-04 14:25:40.971 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 3 2022-11-04 14:25:40.971 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 4 2022-11-04 14:25:40.981 DEBUG (MainThread) [custom_components.powercalc.config_flow] Starting discovery flow: {'unique_id': '4022D880DBE9-relay_0', 'name': 'Prise multimedia', 'entity_id': 'switch.prise_multimedia', 'manufacturer': 'shelly', 'model': 'shelly plug s'} 2022-11-04 14:25:40.982 DEBUG (MainThread) [custom_components.powercalc.power_profile.model_discovery] switch.prise_multimedia: Auto discovered model (manufacturer=Allterco Robotics, model=Shelly Plug S) 2022-11-04 14:25:40.982 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 3 2022-11-04 14:25:40.982 DEBUG (MainThread) [custom_components.powercalc.config_flow] discovery flow 4 File "/config/custom_components/powercalc/config_flow.py", line 448, in async_step_model File "/config/custom_components/powercalc/config_flow.py", line 501, in validate_strategy_config File "/config/custom_components/powercalc/config_flow.py", line 647, in _create_strategy_object File "/config/custom_components/powercalc/strategy/factory.py", line 52, in create custom_components.powercalc.errors.UnsupportedMode: ('Invalid calculation mode', None) 2022-11-04 14:26:09.436 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lampe_buffet: State changed to "off". Power:0.50
Thanks I already suspected it would take that code path in your case. I am working on some changes which should probably resolve it.
Have rewritten some things as in #1220 Here is the updated code. Are you able to test this? See if it makes any difference or you still get the same behaviour.
Yeah!!! Configuration went as intended. I will let them run until tomorrow and see if everything looks fine.
Ah that's great news. Let me know if you are experiencing any issue.
Quick feedback... There is a problem with the ".._power" entity which seems to stay stuck with a default value (0.82W for 2 of them and 0.52w for the third one). I attach 2 screenshots for one of the devices: the one from the native power device and the one from powercalc. It is the same behaviour for the 3 plugs which were identified
This is exactly as expected. Powercalc only adds a power sensor showing the self usage of the plug (it will be different when the relay is activated or not), but not the power of the device connected obviously. That won't make sense of course as powercalc cannot know that and the shelly plug provides power monitoring itself.
Understood. But then, why is your energy entity not taking the shelly power one as a source? So far, it seems to only accumulates the 0.82W coming from your power entity. When I compare the increase your your energy entity and one created with a helpers Riemann sum integral, yours increased by 0.01 and the helpers by 0.18 between 00:00 and 11:00 today. The helpers seems right to me.
There is no need to create a Riemann sum integral helper manually yourself. The energy sensor powercalc creates is actually a Riemann sum integral sensor (exactly the same as the core code).
The difference would be the integration method which powercalc sets to left
by default and when you create one with the trapezoid
method (which is the default with the helpers) it will calculate a little different.
When the power does not change frequently (as in this scenario) you must use integration method left. Also see https://github.com/bramstroker/homeassistant-powercalc/discussions/872.
Actually the energy sensor of powercalc is right and the one you created not. 0.82 * 11 = 9.2 Wh 9.2 / 1000 = 0.009 (rounded to 2 digits is 0.01)
All clear now. Many thanks for your support. Much appreciated!
I'm running HA 2022-11 and powercalc 1.0.1. Since this morning, powercalc identifies Shelly Plug S but does not allow for their configuration. See below screenshot. Pwer outlet are not listed in your documentation, so, is this a bug?