Comments (8)
Thanks for reporting. I have formatted the code. Think I will be able to reproduce and fix the issue with this information
from homeassistant-powercalc.
I am not able to reproduce this issue yet.
Have the following configuration:
switch:
- platform: mqtt
name: Mqtt
state_topic: "mr2/status"
command_topic: "mr2/cmd"
payload_on: "1"
payload_off: "0"
state_on: "1"
state_off: "0"
sensor:
- platform: powercalc
entity_id: switch.mqtt
standby_usage: 0.6
fixed:
power: 36.9
and in my log:
2021-07-23 16:23:51 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:switch.mqtt sensor_name:Mqtt power strategy=FixedStrategy manufacturer= model= standby_usage=0.6
Which version of home assistant are you running?
from homeassistant-powercalc.
Could you enable debug logging for both powercalc and mqtt?
logger:
default: warning
logs:
custom_components.powercalc: debug
homeassistant.components.mqtt: debug
Next restart home assistant, wait for the power calc sensor error, and post the full logs from the beginning of the restart.
from homeassistant-powercalc.
Have also a similiar problem to this. In my case in combination with flux_led. The logs from startup:
2021-07-30 16:55:12 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration truenas 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
2021-07-30 16:55:12 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration skodaconnect 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration alexa_media 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration fontawesome 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration rki_covid 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration cryptoinfo 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
2021-07-30 16:55:12 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration spotcast 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
2021-07-30 16:55:15 WARNING (MainThread) [alexapy.alexalogin] No access token found; falling back to credential login instead of oauth.
2021-07-30 16:55:16 WARNING (MainThread) [homeassistant.config_entries] Config entry 'InternetGatewayDeviceV2 - FRITZ!Box 7490 (UI)' for upnp integration not ready yet: None; Retrying in background
2021-07-30 16:55:16 WARNING (MainThread) [homeassistant.config_entries] Config entry 'FRITZ!Box 7490 (UI)' for upnp integration not ready yet: None; Retrying in background
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:light.deckenlicht_wohnzimmer1 sensor_name:Deckenlicht Wohnzimmer 1 power strategy=LinearStrategy manufacturer= model= standby_usage=0.2
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:light.deckenlicht_wohnzimmer2 sensor_name:Deckenlicht Wohnzimmer 2 power strategy=LinearStrategy manufacturer= model= standby_usage=0.2
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:light.deckenlicht_wohnzimmer3 sensor_name:Deckenlicht Wohnzimmer 3 power strategy=LinearStrategy manufacturer= model= standby_usage=0.2
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:light.deckenlicht_schreibtisch sensor_name:Deckenlicht Schreibtisch power strategy=LinearStrategy manufacturer= model= standby_usage=0.2
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:media_player.lg_fernseher sensor_name:LG Fernseher power strategy=FixedStrategy manufacturer= model= standby_usage=0.5
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:binary_sensor.desktop sensor_name:Desktop power strategy=FixedStrategy manufacturer= model= standby_usage=0.0
2021-07-30 16:55:16 DEBUG (MainThread) [custom_components.powercalc.sensor] Setting up power sensor. entity_id:binary_sensor.hassio_virtural_machine_running sensor_name:KingKong strategy=FixedStrategy manufacturer= model= standby_usage=0.0
2021-07-30 16:55:16 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up powercalc platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/powercalc/sensor.py", line 120, in async_setup_platform
entity_name = entity_state.name
AttributeError: 'NoneType' object has no attribute 'name'
2021-07-30 16:55:16 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up powercalc platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/powercalc/sensor.py", line 120, in async_setup_platform
entity_name = entity_state.name
AttributeError: 'NoneType' object has no attribute 'name'
2021-07-30 16:55:24 WARNING (MainThread) [homeassistant.components.light] Setup of light platform flux_led is taking over 10 seconds.
2021-07-30 16:55:30 WARNING (SyncWorker_4) [homeassistant.components.tplink.common] Unable to communicate with device 192.168.178.75: Communication error
2021-07-30 16:55:30 WARNING (MainThread) [homeassistant.components.switch] Platform tplink not ready yet: None; Retrying in background in 30 seconds
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "light.deckenlicht_wohnzimmer1". Power:5.98
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "light.deckenlicht_wohnzimmer2". Power:5.98
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "light.deckenlicht_wohnzimmer3". Power:5.98
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "light.deckenlicht_schreibtisch". Power:8.47
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "off" for entity "media_player.lg_fernseher". Power:0.5
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "binary_sensor.desktop". Power:90.0
2021-07-30 16:55:53 DEBUG (MainThread) [custom_components.powercalc.sensor] State changed to "on" for entity "binary_sensor.hassio_virtural_machine_running". Power:120.0
2021-07-30 16:55:57 WARNING (SyncWorker_3) [homeassistant.components.tplink.common] Unable to communicate with device 192.168.178.75: Communication error
My yaml-config for the lights:
- platform: flux_led
automatic_add: true
devices:
!secret IP_LED_Fernseher:
name: LED Fernseher
mode: "rgb"
!secret IP_LED_Couchtisch:
name: LED Couchtisch
mode: "rgb"
My yaml- config for powercalc:
- platform: powercalc
entity_id: light.led_couchtisch
name: "Licht LED Couchtisch"
standby_usage: 0.2
linear:
min_power: 0
max_power: 36
- platform: powercalc
entity_id: light.led_fernseher
name: "Licht LED Couchtisch"
standby_usage: 0.2
linear:
min_power: 0
max_power: 14.4
I have HA 2021.7.4 running. Powercalc is setting up before flux_led (my lights), so could this be a problem?
from homeassistant-powercalc.
Yes I think it's the order in which integrations are loaded. I made my integration dependant on some other integrations to make sure they are loaded first, but I cannot add all kind of exotic integrations as a dependency. At the moment the powercalc integration is trying to get the name of your device it was not created yet by the flux_led integration.
I wanted to propose a workaround to see if adding the name
property would help, but I see you already specified a name yourself. The error is thrown when the powercalc integration is trying to retrieve the name of the device you are setting up the virtual power sensor. However I don't need to do that when you manually specify a name for the power sensor. Will have a look if I can fix this logic.
from homeassistant-powercalc.
I just modified the code to extract the name and entity domain from the entity_id, this should get rid of the error you both reported here and should make the power sensor work.
Are you able to test with the master branch?
When it is solved for you I will create a new release.
from homeassistant-powercalc.
I installed the master branch via HACS and in my case everything works now 👍
I'm not deeply into the Home assistant architecture, but is there a way to check if all entities from a domain e.g. lights are loaded? In long term this would be the best solution, to check if all supported domains are fully loaded and then load the powercalc component. Checking via some integration dependencys seems to be annoying in long term, a approach via domains seems more promising if possible
from homeassistant-powercalc.
Nice that it's working for you! The fix is in version 0.2.7
I did have a look around the home assistant codebase how to check if all entities from a domain (ie light) are initialized, but could not really find anything. Also the developers docs and architecture does not mention this.
However the solution I implemented now should fix for all possible use cases and entity types, so no need to search further.
from homeassistant-powercalc.
Related Issues (20)
- Waiting on integrations to complete setup HOT 9
- versione 1.11.8 doenst work HOT 3
- Global search not working anymore in library GUI HOT 1
- LCA007 lookup not working with 1.12.0 HOT 5
- FileNotFoundError - model.json HOT 10
- Use Nanoleaf A19 Matter Bulbs for HomeKit Bulbs HOT 3
- add to group for daily energy HOT 3
- wrong energy when using template HOT 3
- No lookup file found for mode: color_temp HOT 9
- Group problem HOT 9
- Unexpected device attributes HOT 5
- Ikea LED1537R6 is not recognized. HOT 1
- Blocking call to open inside the event loop in Home Assistant 2024.6.0 beta
- Daily energy entities disappear from powercalc UI after reboot HOT 10
- OFF consumption > min ON consumption with TRADFRI bulb E27 WS globe 1055lm (LED2201G8) HOT 1
- PowerCalc: Cannot connect to powercalc.lauwbier.nl:443 HOT 2
- None entities HOT 7
- After every reboot integration automatically creates a None device HOT 32
- Error and not starting after upgrade from 1.12.6 to 1.12.7 HOT 11
- Detected blocking call to open inside the event loop by custom integration 'powercalc' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homeassistant-powercalc.