Since I just finished my new EspDeck model that has backlit keys. I always intended on using these for notifying me of some state in my house so I can take action on it, ideally using the EspDeck itself. This is the first use case I had for the features so I’ll be implementing it so we can start making use of my fancy new NFC Deck to it’s fullest.
In this case I have a smart plug hooked up to an iron. The iron does have an auto off but safety features like that are always destined for failure if you rely on them too much. I want to know when it’s off or on so that if it doesn’t need to be on, it can be turned off easily. In this case, before going to sleep.
Goals
- When the iron smart plug turns on, turns on a key on the NFC Deck
- When the iron smart plug turns off, turns off that key on the NFC Deck
- Hitting the key turns off the smart plug
The abstract goal in this first use case is to notify when some action may need to be taken, that way the key can be activated to take the action.
We’re going to start with two triggers in our automation. Each of these will be given a different trigger ID. One trigger for the smart plug turning on and a second trigger for it turning off.
Now that we have our triggers with IDs setup, we want to add a choose block in the automation actions. This choose block will have two options, one for each trigger using the trigger ID. Then each of those options will have one action to toggle my notification LED.
The on trigger is more interesting as it turns on the notification light and changes the color in one nice little action using the color name. This is using the light turn on service which let’s us change settings while turning on the LED.
The off trigger and action are straight forward, just call the light turn off service.
This automation built in home assistant becomes the following YAML.
- id: '1705775063628'
alias: Master Bedroom Keypad Lighting
description: ''
trigger:
- platform: device
type: turned_on
device_id: 0914cd9c0ad011cc9c86daa3f2c4f2f0
entity_id: 1f6d2ca4d98a314408d8bb5cdfdbd5d6
domain: switch
id: Iron On
- platform: device
type: turned_off
device_id: 0914cd9c0ad011cc9c86daa3f2c4f2f0
entity_id: 1f6d2ca4d98a314408d8bb5cdfdbd5d6
domain: switch
id: Iron Off
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- Iron On
sequence:
- service: light.turn_on
metadata: {}
data:
color_name: red
target:
entity_id: light.esphome_web_75e790_key_4_light
- conditions:
- condition: trigger
id:
- Iron Off
sequence:
- service: light.turn_off
metadata: {}
data: {}
target:
entity_id: light.esphome_web_75e790_key_4_light
Conclusion
This little automation works well and was a good way to get using the new features of the NFCDeck. I’m happy with the simple results and easy to use automations around my house and this is just another way to make use of them.