Repository navigation
Conversation
AGENTS.md forbids async_all() scans during coordinator updates and async_set() on entities the integration does not own, yet every update did both: check_tarif called set_tarif on every entity in Home Assistant and relied on name filters to pick the Hilo tariff selects, and handle_unknown_power summed every entity ending in "_power" (including other integrations') and rewrote attributes of utility meter sensors through set_state. find_meter guessed the smart meter from entity IDs containing "meter" and "_power", and the challenge lock and high_times read sensor.defi_hilo by its entity ID, which breaks once a user renames it. The integration already holds all of this: the sensor platform now records the challenge sensor and the energy meter keys it creates, and unknown power is the smart meter reading minus the readings of the other power devices (skipping unavailable ones, models without a power sensor and null readings, which the entity sum also ignored). fix_utility_sensor only ran while unknown source tracking was enabled, and utility meters inherit device_class and unit from their source energy sensor, which declares them itself, so it is dropped along with set_state. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every coordinator update currently goes through every entity in Home Assistant, which AGENTS.md forbids:
check_tarifcallsset_tarifon every entity inhass.states.async_all()and uses name filters to find the Hilo tariff selects.handle_unknown_poweradds up every entity ending in_power, including other integrations' entities. It also rewrites utility meter sensor attributes throughset_state(hass.states.async_set).find_meterguesses the smart meter from entity IDs containingmeterand_power.high_timesreadsensor.defi_hiloby entity ID, so both break if the user renames that entity.Changes
hilo.challenge_sensor) and records the keys of the energy meters it creates (hilo.energy_meter_keys).check_tarifonly switchesselect.<key>for those meters. Whenuntarificated_devicesis on, it switches only the total meter.UNMONITORED_DEVICESmodels (which get no power sensor) and null readings are skipped, matching what the entity-based sum ignored.find_meter,set_stateandfix_utility_sensorare removed.About removing
fix_utility_sensorIt was only called from
handle_unknown_power, so it only ran when unknown source tracking was enabled. Utility meter sensors take theirdevice_classand unit from their source energy sensor, which declaresSensorDeviceClass.ENERGYitself and also passes it toIntegrationSensoron 2026.11 (#1106).Tests
test_check_tarif_switches_own_meters: selects that aren't Hilo energy meters are left alone, and in untarificated mode only the total meter is switched.test_unknown_power.py: the meter-minus-devices calculation, the skipped devices, and an unavailable smart meter.hilo.challenge_sensorinstead ofsensor.defi_hilo.No entity IDs, unique IDs or snapshots change.
Context
This is the first of the smaller, focused changes offered in #1084. It stands on its own (it fixes the AGENTS.md violations for single-account installs), and it also removes the hardcoded entity IDs that would otherwise collide between accounts.
It overlaps with #1107/#1112 in one hunk of
sensor.py(create_energy_entity's signature, next to the newhilo.energy_meter_keys = []). Whichever lands second can resolve it trivially; I'm happy to rebase on top of them.🤖 Generated with Claude Code