Template support in fritzbox integration - which approach to choose?

I am planning on extending the fritzbox integration for AVM SmartHome devices with support for templates.

(Support for that in the underlying pyfritz library is underway: Add support for templates to library and CLI. by mithomas · Pull Request #52 · hthiery/python-fritzhome · GitHub)

First question: Is this something that would get accepted into the integration?

If so, I see at least two ways to handle templates:

  • button_entities seem like a good fit: one could load all templates as button entities; activating them would mean to apply the templates (since they don’t have state per se and act more like scenes, representing them as switch entities feels wrong)
  • if templates should be no entities at all, one I could also think of having two services
    • one for reading all templates
    • one for actually applying a template given its name or ain

I would favour the button_entity approach - what do you think? Do you have other ideas?

(Raising this question here since this is neither a new FR for the respective category nor an actual issue for the issue tracker - feel free to point to right place for these kinds of discussions.)

I think Fritz templates rather work like scenes than anything else.
Accordingly, they should be imported as scenes, similar to the deConz integration.
That’d allow to apply them via buttons, scripts and automations.

Disclaimer: I only use Fritz templates for new radiator control setups.

So do I, actually. Many thanks for the scenes pointer, I was not aware that scenes could also be implemented from integrations.

Following this suggestion I started the implementation on this one; local tests seem promising so far. The current state is available here in case anyone is interested in a work-in-progress: https://github.com/mithomas/core/tree/feature-fritz-templates
Next step is finishing up the unit tests and prepare the official PR.