From d0e2e4e842bd61cc4a722dcf0d435938b2251ff0 Mon Sep 17 00:00:00 2001 From: Maurice Makaay Date: Thu, 27 May 2021 15:58:46 +0200 Subject: [PATCH] Updated the changelog + example for using lambdas with preset.activate. --- CHANGELOG.md | 3 +++ example.yaml | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e597a42..1de73ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Not yet released] ### Changed +- Made it possible to use lambdas with the `preset.activate` automation. This makes it + possible to link the action to an api service, which exposes the preset functionality + to Home Assistant. The `example.yaml` has been updated with an example for this. - Fixed a rounding error in the slider sensor component. When using custom "range from" / "range to" settings, the maximum value could exceed the "range to" value due to rounding errors. Thanks to Jos for the heads up! diff --git a/example.yaml b/example.yaml index 6a316d6..e4747d8 100644 --- a/example.yaml +++ b/example.yaml @@ -39,6 +39,22 @@ api: # flicker. reboot_timeout: 0s +api: + password: !secret api_password + + # If you want to use light presets (see below) from Home Assistant, + # then you can expose the required functionality as a service here. + # This is an example of how you could expose the activation of a preset. + services: + - service: activate_preset + variables: + my_group: string + my_preset: string + then: + - preset.activate: + group: !lambda 'return my_group;' + preset: !lambda 'return my_preset;' + ota: password: "Password-For-Flashing-This-Device-Over-The-Air"