Skip to content
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

sensor already exist - while it was deleted #2671

Open
5 tasks done
RubenKelevra opened this issue Nov 12, 2024 · 8 comments
Open
5 tasks done

sensor already exist - while it was deleted #2671

RubenKelevra opened this issue Nov 12, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@RubenKelevra
Copy link
Contributor

RubenKelevra commented Nov 12, 2024

System Health details

System Information

version core-2024.11.1
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.4
os_name Linux
os_version 6.6.31-haos-raspi
arch aarch64
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 5000
Installed Version 2.0.1
Stage running
Available Repositories 1528
Downloaded Repositories 17
Home Assistant Cloud
logged_in true
subscription_expiration xxx
relayer_connected false
relayer_region null
remote_enabled false
remote_connected false
alexa_enabled false
google_enabled true
cloud_ice_servers_enabled true
remote_server null
certificate_status null
instance_id xxx
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 13.2
update_channel stable
supervisor_version supervisor-2024.11.2
agent_version 1.6.0
docker_version 27.2.0
disk_total 234.0 GB
disk_used 34.3 GB
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Mosquitto broker (6.4.1), Grocy (0.22.1), Home Assistant Google Drive Backup (0.112.1), Advanced SSH & Web Terminal (19.0.0), Log Viewer (0.17.1), Dnsmasq (1.8.1), phpMyAdmin (0.10.0), ESPHome (2024.10.3), Epic Games Free (debian-2024-10-23), Portainer (2.23.0), Tor (5.0.1), File editor (5.8.0), AppDaemon (0.16.7), Tailscale (0.23.2), openWakeWord (1.10.0), Piper (1.5.2), Whisper (2.2.0), MQTT IO (0.4.0), Postgres 15 (15.5-7), Castsponsorskip (0.8.0), Zigbee2MQTT (1.41.0-1)
Dashboards
dashboards 6
resources 2
views 26
mode storage
Recorder
oldest_recorder_run August 14, 2024 at 19:07
current_recorder_run November 12, 2024 at 19:40
estimated_db_size 9295.19 MiB
database_engine sqlite
database_version 3.45.3

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

I've switched some lamps around and deleted the corresponding lamp configurations in powercalc. Now one lamp has no powercalc config yet and I try to add it, but it insists, that there's already such a sensor ... while well, there is none.

I try to add Hallway Ceiling 1, and there is no instance for it:

Screenshot_20241112_202914

There's also no power and energy entities in the search results, compared to Hallway Ceiling 2, which has some:

Screenshot_20241112_202942

And here's the message I get when I select Hallway Ceiling 1 and click on "Next":

Screenshot_20241112_203012

Not sure what went wrong or how I clean this up.

Reproduction steps

  1. Select new sensor
  2. Select library sensor
  3. Select Hallway Ceiling 1
  4. Select "Next"
  5. See error message

Debug logs

2024-11-12 19:40:31.409 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

2024-11-12 19:41:07.238 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot: Could not calculate power. no brightness set
2024-11-12 19:41:07.238 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_5: Could not calculate power. no brightness set
2024-11-12 19:41:07.244 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_4: Could not calculate power. no brightness set
2024-11-12 19:41:07.248 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_3: Could not calculate power. no brightness set
2024-11-12 19:41:07.248 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_2: Could not calculate power. no brightness set

2024-11-12 19:41:17.061 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot: Could not calculate power. no brightness set
2024-11-12 19:41:17.062 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_5: Could not calculate power. no brightness set
2024-11-12 19:41:17.063 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_2: Could not calculate power. no brightness set
2024-11-12 19:41:17.063 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_3: Could not calculate power. no brightness set
2024-11-12 19:41:17.064 ERROR (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_spot_4: Could not calculate power. no brightness set

2024-11-12 20:36:19.452 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_floor_lamp: Looking up power usage for bri:34 mired:500
2024-11-12 20:36:19.453 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_floor_lamp: Calculated power:0.80399999999999993693933220129110850393772125244140625
2024-11-12 20:36:19.453 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lamp_left_room_floor_lamp: State changed to "on". Power:0.80
2024-11-12 20:36:19.681 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_3: Looking up power usage for bri:34 mired:500
2024-11-12 20:36:19.686 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_3: Calculated power:0.442000000000000003996802888650563545525074005126953125
2024-11-12 20:36:19.686 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lamp_left_room_ceiling_3: State changed to "on". Power:0.44
2024-11-12 20:36:19.726 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ambient_desktop: Looking up power usage for bri:34 mired:500
2024-11-12 20:36:19.726 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ambient_desktop: Calculated power:2.3940000000000001278976924368180334568023681640625
2024-11-12 20:36:19.726 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lamp_left_room_ambient_desktop: State changed to "on". Power:2.39
2024-11-12 20:36:19.780 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_1: Looking up power usage for bri:34 mired:500
2024-11-12 20:36:19.780 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_1: Calculated power:0.442000000000000003996802888650563545525074005126953125
2024-11-12 20:36:19.780 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lamp_left_room_ceiling_1: State changed to "on". Power:0.44
2024-11-12 20:36:19.796 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_2: Looking up power usage for bri:34 mired:500
2024-11-12 20:36:19.797 DEBUG (MainThread) [custom_components.powercalc.strategy.lut] light.lamp_left_room_ceiling_2: Calculated power:0.442000000000000003996802888650563545525074005126953125
2024-11-12 20:36:19.797 DEBUG (MainThread) [custom_components.powercalc.sensors.power] light.lamp_left_room_ceiling_2: State changed to "on". Power:0.44

Diagnostics dump or YAML config

powercalc: !include powercalc.yaml

And

enable_autodiscovery: true
@RubenKelevra RubenKelevra added the bug Something isn't working label Nov 12, 2024
@bramstroker
Copy link
Owner

Have a look in .storage/core.config_entries if you have any match for light.lamp_hallway_ceiling_1.
And also in your configuration.yaml if you set up this one already if you use yaml.

Otherwise just give it a unique_id as indicated, than it should continue anyway.

@dagobert
Copy link
Collaborator

I think I have encountered this with non powercalc devices/sensors. When deleting a device the information about this is still stored in home assistantant and you cannot add the device/sensor again under the same name. Even restarting HA does not change this.

A wild guess is that as you can see in core.zzz files there are sections about deleted devices/entities.

A definite solution is to find the entries in the core.zzz files and delete them. You need to habe HA stopped for this AND you need to know what you are doing! Otherwise you will break your config.

I am sure it is not an issue of powercalc.

@RubenKelevra
Copy link
Contributor Author

Have a look in .storage/core.config_entries if you have any match for light.lamp_hallway_ceiling_1.

This file contains this light twice. One time in the settings for Adaptive Lighting and one time in the light group this light is in. Nothing in regard to PowerCalc.

And also in your configuration.yaml if you set up this one already if you use yaml.

I've already looked through my powercalc.yaml (and the configuration.yaml). I've deleted those setting a year ago or so and switched to the UI.

Otherwise just give it a unique_id as indicated, than it should continue anyway.

Sure, I just was curious what the cause is... and if it can be fixed.

@RubenKelevra
Copy link
Contributor Author

@bramstroker I've added it now with the unique ID lamp_hallway_ceiling_one and powercalc set it up fine, but with the *_1-IDs, not the specified *_one id.

Where's the *_one id used then, if not for the power meter and energy meter?

Screenshot_20241113_005525

@bramstroker
Copy link
Owner

When you see _1 or any other numeric postfix this generally means an entity with same name already exists in HA.
Please check entities list if you have any orphaned entities.

@bramstroker
Copy link
Owner

@RubenKelevra can we close this issue?

@RubenKelevra
Copy link
Contributor Author

When you see _1 or any other numeric postfix this generally means an entity with same name already exists in HA. Please check entities list if you have any orphaned entities.

Well, except that the light is called " 1", so if there would be a "_1" added for this reason, it would be ending up being named "_1_1".

@RubenKelevra can we close this issue?

Well, if you don't wanna fix the issue? It's no blocker for me, just weird.

@bramstroker
Copy link
Owner

Let me have a look.

Do you have diagnostics from the related config entry? You can find that on powercalc integration page, find the entry, click three dots and download diagnostics.

Also enable debug logs and share related logs where it's saying Creating power sensor and Creating energy sensor for the concerning entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants