Hi there!
I’d like to inform you on the status of the Awesome HA Blueprints project.
In the last month I’ve been able to develop a few blueprints, with a huge help from the community which many times helped with debugging and suggested new features and enhancements.
In the last weeks I’ve noticed an interesting trend in the Community Forum: many of the proposed blueprints are used to create controller-based automations, like for example to control a light with a wireless switch. The main issue is that many of them essentially try to accomplish the same task, but with different controller models (IKEA, Aqara, etc.), integrations used to setup the controller (ZHA, Zigbee2MQTT, deCONZ, ZWave, etc.) and even type of objects to control (RGB lights, lights with white temperature control etc.). The result is a large collection of similar blueprints with a lot of duplicate code across the whole Blueprint Exchange category.
While thinking on how to tackle this issue, I’ve tried to come up with a solution to group all these similar blueprints in a blueprint ecosystem which would maximize flexibility and scalability. The idea is to only have a blueprint for each controller model, which should be able to handle events raised by the controller despite the integration used to connect it to HA, and a blueprint for each common use-case, such as light or media player control. Blueprints from these categories should then be able to “talk” to each other and accomplish the task of building a controller-based automation.
That’s why today I’m adding to the project two new categories of blueprints in addition to the existing Automations category: Controllers and Hooks.
Controllers are blueprints which allow to easily integrate a wide range of controllers (wall switches, remotes, dimmers, etc.) and use them to run a set of actions when interacting with them. They consist of a practical abstraction layer for easily building controlled-based automations without worrying about the handling of raw controller events, and the integration used to connect controllers to Home Assistant (Zigbee2MQTT, ZHA, deCONZ, ZWave, proprietary hubs, etc.).
Some of them also extend controller functionality by implementing virtual events not natively supported by the hardware (eg. double button press events).
Most importantly, beside providing action sequences to Controller blueprints to build a custom controller-based automation, you can connect Controllers with Hooks.
Hooks are blueprints which seamlessly integrate with Controllers to enable control of lights, media players and much more, without you ever writing a single line of code.
While Controllers are responsible for integrating the hardware and exposing an abstract interface to the user, Hooks can, as the name suggests, link to this interface and listen for events fired by a controller. Hooks take care of providing the actual control functionality for common use cases.
If you want to build a controller-based automation with Hooks, first create an automation with a Controller blueprint. You can then create an automation with the desired Hook blueprint, making sure that you provide the same controller device or entity used in the corresponding Controller blueprint. This key step will link the two automations and ensure the Hook will respond to events fired by the Controller.
For more flexibility, you can link multiple Hooks to the same Controller: just create a Controller automation, then build as many Hook automations as needed. Moreover, if you need to customize certain actions or extend a Hook functionality, you can provide custom actions to the Controller blueprint, which will be run when a certain event is raised.
The ultimate goal here is to build a blueprint ecosystem which would significantly reduce the effort required for building controller-based automations.
For now only two IKEA Controllers, light and media player Hooks are implemented but I’d like to expand the list of supported Controllers and available Hooks in the nearby future.
As always, if you have any feedback or suggestion on this I’d be really happy to hear your voice.
Happy automating to everyone!