{"id":3737,"date":"2024-02-05T10:06:00","date_gmt":"2024-02-05T16:06:00","guid":{"rendered":"https:\/\/lab.rapternet.us\/?p=3737"},"modified":"2024-01-27T21:01:49","modified_gmt":"2024-01-28T03:01:49","slug":"nfcdeck-backlit-key-notification","status":"publish","type":"post","link":"https:\/\/lab.rapternet.us\/?p=3737","title":{"rendered":"NfcDeck Backlit Key Notification"},"content":{"rendered":"\n<p>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&#8217;ll be implementing it so we can start making use of my fancy new NFC Deck to it&#8217;s fullest.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>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&#8217;s off or on so that if it doesn&#8217;t need to be on, it can be turned off easily. In this case, before going to sleep.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Goals<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When the iron smart plug turns on, turns on a key on the NFC Deck<\/li>\n\n\n\n<li>When the iron smart plug turns off, turns off that key on the NFC Deck<\/li>\n\n\n\n<li>Hitting the key turns off the smart plug<\/li>\n<\/ul>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>We&#8217;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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"972\" height=\"762\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-8.png\" alt=\"\" class=\"wp-image-3750\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-8.png 972w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-8-300x235.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-8-768x602.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Triggers<\/figcaption><\/figure>\n\n\n\n<p>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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"967\" height=\"441\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-9.png\" alt=\"\" class=\"wp-image-3751\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-9.png 967w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-9-300x137.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-9-768x350.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Iron On Trigger<\/figcaption><\/figure>\n\n\n\n<p>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&#8217;s us change settings while turning on the LED.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"924\" height=\"721\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-10.png\" alt=\"\" class=\"wp-image-3752\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-10.png 924w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-10-300x234.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-10-768x599.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Iron On Trigger Action<\/figcaption><\/figure>\n\n\n\n<p>The off trigger and action are straight forward, just call the light turn off service.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"971\" height=\"881\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-11.png\" alt=\"\" class=\"wp-image-3753\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-11.png 971w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-11-300x272.png 300w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/image-11-768x697.png 768w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Iron Off Trigger<\/figcaption><\/figure>\n\n\n\n<p>This automation built in home assistant becomes the following YAML.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">- id: '1705775063628'<br>  alias: Master Bedroom Keypad Lighting<br>  description: ''<br>  trigger:<br>  - platform: device<br>    type: turned_on<br>    device_id: 0914cd9c0ad011cc9c86daa3f2c4f2f0<br>    entity_id: 1f6d2ca4d98a314408d8bb5cdfdbd5d6<br>    domain: switch<br>    id: Iron On<br>  - platform: device<br>    type: turned_off<br>    device_id: 0914cd9c0ad011cc9c86daa3f2c4f2f0<br>    entity_id: 1f6d2ca4d98a314408d8bb5cdfdbd5d6<br>    domain: switch<br>    id: Iron Off<br>  condition: []<br>  action:<br>  - choose:<br>    - conditions:<br>      - condition: trigger<br>        id:<br>        - Iron On<br>      sequence:<br>      - service: light.turn_on<br>        metadata: {}<br>        data:<br>          color_name: red<br>        target:<br>          entity_id: light.esphome_web_75e790_key_4_light<br>    - conditions:<br>      - condition: trigger<br>        id:<br>        - Iron Off<br>      sequence:<br>      - service: light.turn_off<br>        metadata: {}<br>        data: {}<br>        target:<br>          entity_id: light.esphome_web_75e790_key_4_light<br><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>This little automation works well and was a good way to get using the new features of the NFCDeck. I&#8217;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.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"771\" height=\"1024\" src=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098-771x1024.jpg\" alt=\"\" class=\"wp-image-3767\" srcset=\"https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098-771x1024.jpg 771w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098-226x300.jpg 226w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098-768x1020.jpg 768w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098-1157x1536.jpg 1157w, https:\/\/lab.rapternet.us\/wp-content\/uploads\/2024\/01\/pxl_20240123_0340374256898576259545801098.jpg 1506w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><figcaption class=\"wp-element-caption\">Notification Light Active <\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Additional Reading on the NFC Deck<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/lab.rapternet.us\/?p=3514\">NFC Deck Version 1<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/lab.rapternet.us\/?p=1397\">EspDeck Version 1<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/lab.rapternet.us\/?p=1506\">EspDeck Version 2<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/lab.rapternet.us\/?p=2811\">EspDeck Version 3<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/lab.rapternet.us\/?p=1616\">EspDeck Automations<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;ll be implementing it &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/lab.rapternet.us\/?p=3737\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;NfcDeck Backlit Key Notification&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":3767,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[76,74,39,103,49],"class_list":["post-3737","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-to","tag-espdeck","tag-esphome","tag-home-assistant","tag-nfcdeck","tag-smart-home"],"_links":{"self":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/3737","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3737"}],"version-history":[{"count":7,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/3737\/revisions"}],"predecessor-version":[{"id":3814,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/posts\/3737\/revisions\/3814"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=\/wp\/v2\/media\/3767"}],"wp:attachment":[{"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3737"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3737"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab.rapternet.us\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3737"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}