Skip to content

[Bug]: Source binary battery sensor initial 'on' state does not trigger battery_low_binary_state setter on setup/restart #5078

Description

@lurisin

Checklist

  • I have restarted Home Assistant after the HACS or manual install.
  • I have read the FAQ's.
  • 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 any previous issues..

Battery Notes Version

3.5.3

Describe the issue

When adding a device whose source battery sensor is a binary_sensor (device_class: battery, where on = low battery), Battery Notes initializes the device entities with battery status OK (False), even though the underlying source entity is already in the on (Low Battery) state.

Looking at the debug logs, during entity creation or startup, Battery Notes logs binary sensor battery_low set to: True, but the battery_low_binary_state setter is never executed. Consequently, the exposed Home Assistant entity (binary_sensor.<device>_battery_plus_low) remains in the default off (OK) state.

The integration only updates the exposed entity to True if a live state change event occurs while HA is running (e.g., toggling the source sensor from off to on via Developer Tools).

Reproduction steps

  1. Have a device with a source binary_sensor (battery class) currently in the on state (Low Battery).
  2. Add the device to Battery Notes (or restart Home Assistant / reload the integration).
  3. Observe the newly created entity binary_sensor.<device>_battery_plus_low.
    • Result: The state is off (OK) instead of on (Low).
  4. Remove the device from Battery Notes and re-add it.
    • Result: The state remains off (OK).
  5. In Developer Tools > States, manually toggle the source binary sensor state to off, then back to on.
    • Result: The battery_low_binary_state setter fires and the Battery Notes entity immediately updates to on (Low).

System Health details

System Information

version core-2026.8.3
installation_type Home Assistant OS
dev false
hassio true
docker true
container_arch aarch64
user root
virtualenv false
python_version 3.14.6
os_name Linux
os_version 6.18.39-haos
arch aarch64
timezone America/Chicago
config_dir /config
Home Assistant Cloud
logged_in true
subscription_expiration March 30, 2027 at 7:00 PM
relayer_connected true
relayer_region us-east-1
remote_enabled true
remote_connected true
remote_server [REDACTED].ui.nabu.casa
alexa_enabled true
google_enabled false
cloud_ice_servers_enabled false
certificate_status ready
instance_id [REDACTED]
iot_state connected
iot_tries 0
certificate_expire_date October 5, 2026 at 11:51 PM
certificate_fingerprint [REDACTED]
certificate_alternative_names undefined
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
HACS
GitHub API ok
GitHub Content ok
GitHub Web ok
HACS Data ok
GitHub API Calls Remaining 5000
Installed Version 2.0.5
Stage running
Available Repositories 4086
Downloaded Repositories 16
Home Assistant Supervisor
host_os Home Assistant OS 18.2
update_channel stable
supervisor_version supervisor-2026.08.0
agent_version 1.10.0
docker_version 29.6.2
disk_total 28.0 GB
disk_used 15.5 GB
nameservers [REDACTED]
healthy true
supported true
host_connectivity true
supervisor_connectivity true
ntp_synchronized true
virtualization
board green
disk_life_time 0 %
supervisor_api ok
version_api ok
installed_addons Matter Server (9.2.0), Govee to MQTT Bridge (2026.03.25-ab9deb66), ESPHome Device Builder (2026.8.1), Advanced SSH & Web Terminal (24.1.3), Mosquitto broker (7.1.0), File editor (6.1.0), Z-Wave JS (1.7.1)
Dashboards
dashboards 7
resources 8
views 23
mode storage
Network Configuration
adapters lo (disabled), end0 (enabled, default, auto), docker0 (disabled), hassio (disabled), veth6cb4a99 (disabled), veth3e83b31 (disabled), veth5e360cc (disabled), vethc00d2c9 (disabled), vethcb2f04c (disabled), vethea9d15f (disabled), veth0104ecc (disabled), veth81ecf02 (disabled), vethc3c5041 (disabled)
ipv4_addresses lo (127.0.0.1/8), end0 ([REDACTED]), docker0 ([REDACTED]), hassio ([REDACTED]), veth... ()
ipv6_addresses lo (::1/128), end0 ([REDACTED]), docker0 ([REDACTED]), hassio ([REDACTED]), veth... ([REDACTED])
announce_addresses [REDACTED]
Recorder
oldest_recorder_run August 19, 2026 at 7:11 AM
current_recorder_run August 29, 2026 at 6:40 AM
estimated_db_size 556.12 MiB
database_engine sqlite
database_version 3.53.2

Debug logs

-- Step 1: Removing device sub-entry --
2026-08-29 07:03:51.695 DEBUG (MainThread) [custom_components.battery_notes] Removing sub entry 01M16P90TXTFCXJQHM0A2C8K5C from config entry 01M05K6ZWR0GF93ATV5W2W9A7Y
2026-08-29 07:03:51.707 DEBUG (MainThread) [custom_components.battery_notes] Removed entity binary_sensor.patio_door_battery_plus_low for subentry 01M16P90TXTFCXJQHM0A2C8K5C
2026-08-29 07:03:51.727 DEBUG (MainThread) [custom_components.battery_notes] Removed entity button.patio_door_battery_replaced for subentry 01M16P90TXTFCXJQHM0A2C8K5C
2026-08-29 07:03:51.736 DEBUG (MainThread) [custom_components.battery_notes] Removed entity sensor.patio_door_battery_type for subentry 01M16P90TXTFCXJQHM0A2C8K5C
2026-08-29 07:03:51.741 DEBUG (MainThread) [custom_components.battery_notes] Removed entity sensor.patio_door_battery_last_replaced for subentry 01M16P90TXTFCXJQHM0A2C8K5C

-- Step 2: Re-adding device while source entity is ON (Bug occurs here) --
2026-08-29 07:04:09.289 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Manually updated battery_notes data
2026-08-29 07:04:09.290 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Update coordinator
2026-08-29 07:04:09.290 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Finished fetching battery_notes data in 0.001 seconds (success: True)
2026-08-29 07:04:09.290 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Manually updated battery_notes data
2026-08-29 07:04:09.291 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: True
2026-08-29 07:04:09.291 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Update coordinator
2026-08-29 07:04:09.291 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Finished fetching battery_notes data in 0.001 seconds (success: True)
2026-08-29 07:04:09.292 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: True
(Note: The coordinator sets state to True internally, but the setter never triggers, leaving the HA entity in 'off' state).

-- Step 3: Manually toggling source state to OFF in Developer Tools --
2026-08-29 07:04:32.714 DEBUG (MainThread) [custom_components.battery_notes.coordinator] battery_threshold event fired Low: False via battery_low_binary_state setter
2026-08-29 07:04:32.714 DEBUG (MainThread) [custom_components.battery_notes.coordinator] battery_increased event fired via binary sensor
2026-08-29 07:04:32.715 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Manually updated battery_notes data
2026-08-29 07:04:32.715 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: False
2026-08-29 07:04:32.716 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Update coordinator
2026-08-29 07:04:32.716 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Finished fetching battery_notes data in 0.001 seconds (success: True)
2026-08-29 07:04:32.716 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: False

-- Step 4: Manually toggling source state back to ON in Developer Tools --
2026-08-29 07:05:04.048 DEBUG (MainThread) [custom_components.battery_notes.coordinator] battery_threshold event fired Low: True via battery_low_binary_state setter
2026-08-29 07:05:04.048 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Manually updated battery_notes data
2026-08-29 07:05:04.049 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: True
2026-08-29 07:05:04.049 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Update coordinator
2026-08-29 07:05:04.050 DEBUG (MainThread) [custom_components.battery_notes.coordinator] Finished fetching battery_notes data in 0.001 seconds (success: True)
2026-08-29 07:05:04.050 DEBUG (MainThread) [custom_components.battery_notes.binary_sensor] binary_sensor.patio_door_battery binary sensor battery_low set to: True

Diagnostics dump

No response

Activity

  1. andrew-codechimp commented on Aug 29, 2026

    @andrew-codechimp
    Owner

    Thanks for the detailed report, I'll look into this.

  2. added
    bug
    on Aug 29, 2026
  3. linked a pull request that will close this issueFix binary low sensor #5080on Aug 30, 2026
  4. andrew-codechimp commented on Sep 1, 2026

    @andrew-codechimp
    Owner

    Version 3.6.3 now fixes this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions