Broken cover template after migration to new template mode

Hi guys,

with the recent update to 2025.12, I got lots of warning about using of templates on my configuration. I had some templates for covers and other stuff, so yesterday i’ve followed the instructio about the warning and reconfigure template using the suggested code.

This makes templates to works without issue into HA app and also voice assistant, but has broken my Home Kit devices. I got all cover (shutter) as unsupported on Home App.

Here is my original configuration (included before as cover on configuration.yaml):

template:
  - cover:
      - device_class: 'shutter'
        open_cover:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'script.open_cover'
        close_cover:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'script.close_cover'
        stop_cover:
          - data:
              entity_id: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'cover.stop_cover'
        set_cover_position:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            data_template:
              position: '{{ position }}'
            action: 'script.set_cover'
        default_entity_id: 'cover.tapparella_salone_l'
        name: 'Salone Lunga'
        position: '{{ state_attr("cover.shelly25p_tapparella_salone_lunga", "current_position") }}'

and this is the new one (included as template on configuration.yaml):

  - cover:
      - device_class: 'shutter'
        open_cover:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'script.open_cover'
        close_cover:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'script.close_cover'
        stop_cover:
          - data:
              entity_id: 'cover.shelly25p_tapparella_salone_lunga'
            action: 'cover.stop_cover'
        set_cover_position:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
            data_template:
              position: '{{ position }}'
            action: 'script.set_cover'
        default_entity_id: 'cover.tapparella_salone_l'
        name: 'Salone Lunga'
        position: '{{ state_attr("cover.shelly25p_tapparella_salone_lunga", "current_position") }}'

Any ideas why it doesn’t work anymore?

I’m on iOS 26.2 with Home app already updated, and before this change everything was working as expected.

Thanks in advance :slight_smile:

Go here and read thru this thread to help you adjust those.

Also here is a custom Integration to convert them for you if that doesn’t work for you.

Comment there if you need more help.

I don’t know what your script does, but this doesn’t look right to me. Did the repair really generate that?

Maybe try (obviously untested):

        set_cover_position:
          - data:
              cover_name: 'cover.shelly25p_tapparella_salone_lunga'
              position: '{{ position }}'
            action: 'script.set_cover'

The script is used to check if alarm system is enabled or not (because I have sensors on the shutter), so it avoids to open/close the covers.

I’ve commented, restarted HA, the un-commented again and now covers are back in HA, but now I cannot move the covers back to their Rooms. Home App gives me a generic error :frowning:

Are you trying to do this via the Home Assistant UI? You will likely need to assign a unique_id: key to each cover to allow that. Any unique string will do - you can use sites like this to generate one.

I assume you mean the Home Assistant app?

BTW, just noticed you pasted the same code for your original and updated versions. Did your original code actually already have a unique id? If so, just use that

The repair would have had unique id if he had it in his original configuration

Which leaves me puzzled as to how the original covers were ever assigned to a room. And the repair wouldn’t have generated a data_template key either surely?

It would have if their config had it before. It’s valid, but odd

no I mean HomeKit app on iOS

So guys what do you suggest? The problems seems only on the cover entities :frowning:

There’s context missing that you aren’t providing, it will work identical to the old configuration.

the old configuration was working, when moving to the new one, after first attempt (so removing the config and start homekit bridge without template) Home app said that device is not compatbile, now it appears to be compatible but I cannot move. I think there is something broken into Home app DB.

Can I recreate uuid for cover template? So it should be new entities on Home app DB (iOS) and may be I can move back to their original rooms

Thanks

You shouldn’t have to do any of that. Your config is entity_id based, so your entity_id is what drives it all.

Restarting after removing the legacy config in favor of the modern config would have brought it all back without issue.

If the entity itself works within HA but not within Homekit, then you’d need to go through whatever the process is to adjust homekit.

See the HomeKit Bridge troubleshooting section

the assistant for modern config suggested a not working config, so I had to modify the new config and use template include because it doesn’t work as cover include…

So there should be some ID that was changed probably

If I put back old config, the covers can be moved, that’s very strange…

That is not possible. The configuration that is provided will always supply a working config because that’s what’s passed to the entity generation. The legacy template configuration has always pass through a translator to the modern configuration. So the repair just provides the yaml after the translation occurred. The code has been using the translated yaml for 4 years at this point under the hood so it’s guaranteed to work.

If you altered it, you likely broke functionality.

I had to delete everything from Homekit export and add it back again after minutes, then it started to works again…

probably some stuff was broken on the Home iOS app… now it’s ok :slight_smile: