I have a Home Assistant wall panel in my kitchen. It's a 10 inch tablet mounted in landscape orientation. As the first step in my notification plan, I wanted to put some kind of visual notification on that wall panel. I'm starting off simple and might do something more elaborate later. For now, I want some kind of notification that either the washer or dryer is in the stopped state, and I want the notification to go away when someone gives them attention. In my scheme, anyone opening either door will cause that machine to move on from the stopped state.
I defined a binary sensor in a triggered template. It's triggered by any state or attribute change in the washer or dryer. The state of the template sensor is on if either the washer or dryer is stopped; otherwise, the template sensor is off.
- trigger: - platform: state entity_id: - input_select.washer_state - input_select.dryer_state binary_sensor: - name: Laundry needs attention state: >- {% if states('input_select.washer_state')|lower == 'stopped' or states('input_select.dryer_state')|lower == 'stopped' %} on {% else %} off {% endif %}
In the wall panel main screen, I use a custom button-card with a tap action that displays the laundry machine states. I directly followed the example from the documentation of blinking the card based on an entity state. Here, the entity is the triggered template sensor defined just above.
type: custom:button-card name: Laundry entity: binary_sensor.laundry_needs_attention color_type: label-card color: rgba(7, 103, 215, 0.5) icon: mdi:tumble-dryer styles: card: - width: 80px - height: 72px state: - value: 'on' color: yellow styles: card: - animation: blink 2s ease infinite - operator: default color: rgba(7, 103, 215, 0.5) tap_action: action: navigate navigation_path: /wjc-subpanels/laundry?wp_enabled=true
The button is normally a steady blue, but it slowly pulses yellow if either of the machines is stopped. When either machine changes state, the triggered template sensor will change state, and the button will go back to steady blue.
I had some difficulty creating the triggered template sensor. Even though Home Assistant developer tools has a button for reloading template entities, I found that they didn't completely pick up changes until I restarted Home Assistant. Most of the time, it worked as expected, so it's either some edge case or I was doing something wrong.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.