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

Allow Home Assistant OTA Update entity to show progress while updating #25632

Merged
merged 6 commits into from
Jan 7, 2025

Conversation

jbouwh
Copy link

@jbouwh jbouwh commented Jan 6, 2025

Background

When and OTA update is in progress, no progress percentage is shown in Home Assistant.
The current MQTT OTA config update set json_attributes which should not be used.

Proposed change

This PR will use the value_template to extract latest_version, installed_version and update_percentage from state_topic instead. This will allow to use the progress attribute to indicate the progress percentage in Home Assistant.
There is no need to used latest_version_topic and latest_version_template.

A sample config payload would look like:

{
  "availability": [
    {
      "topic": "zigbee2mqtt/bridge/state",
      "value_template": "{{ value_json.state }}"
    }
  ],
  "command_topic": "zigbee2mqtt/bridge/request/device/ota_update/update",
  "device": {
    "hw_version": 1,
    "identifiers": [
      "zigbee2mqtt_0x943469fffec8bf65"
    ],
    "manufacturer": "IKEA",
    "model": "STYRBAR remote control",
    "model_id": "E2001/E2002",
    "name": "Slaapkamer wandbediening",
    "sw_version": "2.4.5",
    "via_device": "zigbee2mqtt_bridge_0xe0798dfffe1a1fc9"
  },
  "device_class": "firmware",
  "entity_category": "config",
  "entity_picture": "https://github.com/Koenkk/zigbee2mqtt/raw/master/images/logo.png",
  "name": null,
  "object_id": "slaapkamer_steven_wandbediening",
  "origin": {
    "name": "Zigbee2MQTT",
    "sw": "2.0.0",
    "url": "https://www.zigbee2mqtt.io"
  },
  "payload_install": "{\"id\": \"0x943469fffec8bf65\"}",
  "state_topic": "zigbee2mqtt/Slaapkamer wandbediening",
  "unique_id": "0x943469fffec8bf65_update_zigbee2mqtt",
  "value_template": "{\"latest_version\": \"{{ value_json['update']['latest_version'] }}\", \"installed_version\": \"{{ value_json['update']['installed_version'] }}\", \"update_percentage\": {{ value_json['update'].get('progress', 'null') }} }"
}

@jbouwh jbouwh changed the title Allow Home Assistant OTA Update entity to show progress while udating Allow Home Assistant OTA Update entity to show progress while updating Jan 6, 2025
@Koenkk Koenkk merged commit 318dc04 into Koenkk:dev Jan 7, 2025
11 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Jan 7, 2025

Thanks! ❤️

@jbouwh jbouwh deleted the mqtt-update-ota-progress branch January 7, 2025 19:49
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.

2 participants