Auto navigate to specific dashboard on sensor event?

Hi,
I’ve stuck a sensor in my freezer and got that working to a point that if temperature is warmer than 16oC, then the widget icon turns dramatic.

But what I would really like is that when this occurs, it automatically navigates to an “alarm.dash” with no auto timeout so I get the best chance of seing it.

I got my sensor data down to binary “on and off” meaning on=ok, off=freezer too hot but I can’t find in the doc or example (too few) how to build this in the dashboard. Any suggestions?

I’ll answer myself as I found the answer from another trail.
(To give credit - it’s based on this answer)

Recap: if my sensor say “off”, it means the freezer door is opened because the temperature inside went up. I want my HAdashboard to switch to a custom dashboard called alert.dash to make sure I see that.

You will need 3 things

  1. Transform your sensor value to “on” and “off”
  2. Deploy a small phyton script in appdaemon
  3. Deploy / modify a small yaml file in appdaemon

In Home Assistant

######Comments##########
# This is in HomeAssistant/config/configuration.yaml
# a binary sensor let you transform a sensor value into something else
# Once HA is restarted, I will get a new entity available called binary_sensor.freezer_on_off
# the "lower: -16" is my threshold.  Colder than -16oC, it will sates "on".  Otherwise "off"
########################
binary_sensor:
  - platform: threshold
    name: freezer_on_off
    entity_id: sensor.shelly_shht_1_e010c7_temperature
    lower: -16

The python script in appdaemon

######Comments##########
# This is a new file created: appdaemon/apps/freezer_status.py
# the filename is freezer_status.py
#   - attention, in some other docs, they say it's in a sub directory of appdaemon/conf/apps
#   - for me it was appdaemon/apps
# In theory, you can use this "as is" - no modifications.  
# This is NOT where you configure the name of your dashboards
########################
import appdaemon.plugins.hass.hassapi as hass

class Navigate(hass.Hass):
# Listen for state changes for the sensor
    def initialize(self):
        self.listen_state(self.freezer_status_change, self.args["freezer_status_sensor"])

    def freezer_status_change(self, entity, attribute, old, new, kwargs):
        # Check if the sensor state is on or off.
        if  new == "on":
            self.dash_navigate("/" + self.args["on_dashboard"])
        elif new == "off":
            self.dash_navigate("/" + self.args["off_dashboard"])

The yaml file in appdaemon

######Comments##########
# This is in appdaemon/apps/apps.yaml
# I added the following to this file
# You need to REPLACE "normal" and "freezer_alert" with the names of your dashboards
# do not add the .dash extension
########################
freezer_status_nav:
  class: Navigate
  module: freezer_status
  freezer_status_sensor: binary_sensor.freezer_on_off
  on_dashboard: normal
  off_dashboard: freezer_alert

Restart appdaemon

Good luck!