Skip to content

Comments

fix: republish command entity states after broker/HA restart#402

Merged
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/ha-unknown-after-restart
Feb 19, 2026
Merged

fix: republish command entity states after broker/HA restart#402
nanomad merged 1 commit intoSAIC-iSmart-API:developfrom
nanomad:fix/ha-unknown-after-restart

Conversation

@nanomad
Copy link
Contributor

@nanomad nanomad commented Feb 17, 2026

Command entities (target SoC, refresh periods, AC temp, charge current limit, refresh mode) show "unknown" in Home Assistant when retained MQTT messages are lost after a broker restart or HA restart, because change detection prevents re-publishing identical values.

  • Add VehicleState.republish_command_states() to unconditionally publish all command entity values, bypassing change detection
  • Make HomeAssistantDiscovery.publish_ha_discovery_messages() return bool to signal when discovery was actually published
  • Call republish_command_states() after successful discovery publication
  • Add on_mqtt_reconnected() callback chain to reset HA discovery state on MQTT broker reconnection, triggering re-publish on next poll
  • Add VehicleHandler.reset_ha_discovery() for reconnection flow

@nanomad nanomad force-pushed the fix/ha-unknown-after-restart branch from 201d6a7 to 72d0bd8 Compare February 17, 2026 22:48
Command entities (target SoC, refresh periods, AC temp, charge current
limit, refresh mode) show "unknown" in Home Assistant when retained MQTT
messages are lost after a broker restart or HA restart, because change
detection prevents re-publishing identical values.

- Add VehicleState.republish_command_states() to unconditionally publish
  all command entity values, bypassing change detection
- Make HomeAssistantDiscovery.publish_ha_discovery_messages() return bool
  to signal when discovery was actually published
- Call republish_command_states() after successful discovery publication
- Add on_mqtt_reconnected() callback chain to reset HA discovery state
  on MQTT broker reconnection, triggering re-publish on next poll
- Add VehicleHandler.reset_ha_discovery() for reconnection flow
@nanomad nanomad force-pushed the fix/ha-unknown-after-restart branch from 72d0bd8 to 9d5e253 Compare February 17, 2026 22:58
@nanomad nanomad merged commit 7a6e77b into SAIC-iSmart-API:develop Feb 19, 2026
2 checks passed
@nanomad nanomad deleted the fix/ha-unknown-after-restart branch February 19, 2026 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant