-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities manually configured in configuration.yaml are not recognized by powercalc #52
Comments
Thanks for reporting. I have formatted the code. Think I will be able to reproduce and fix the issue with this information |
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: Which version of home assistant are you running? |
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. |
Have also a similiar problem to this. In my case in combination with flux_led. The logs from startup:
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? |
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 |
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. |
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 |
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. |
Hi guys
I have 5 switch entities and 2 light entities configured manually in my configuration.yaml, but none of them the electrical consumption sensor works only in auto-discoveries.
This is an example of a part of my configuration and my problem:
switch in configuration.yaml:
sensor in configuration.yaml:
Log:
What should i do to solve this problem? I thank the attention.
Sorry for formatting the codes, I had problems with formatting the text here.
The text was updated successfully, but these errors were encountered: