🔹 Browser_mod - turn your browser into a controllable device, and a media_player

This is an old query but no one ever answered you and I was working on this so here’s what I worked out. I was trying to use last_seen but because it’s an attribute of the sensor created by browser mod it becomes unavailable as soon as my iPad kiosk sleeps and the related template becomes invalid. last_updated, however, is still accessible when the sensor is unavailable.
Sensor:

  - platform: template
    scan_interval: 10
    sensors:
      kiosk_last_updated:
        friendly_name: "seconds ago kiosk was last updated"
        value_template: "{{ (as_timestamp(now()) - as_timestamp(states.sensor.bm_ca_kiosk_ipp.last_updated)) | int() }}"
        unit_of_measurement: 'sec'

Automation:

- id: 'id 30.2'
  alias: "kiosk revert to home"
  trigger:
    - platform: state
      entity_id: binary_sensor.hue_motion_sensor_2_motion
      to: "on"
  condition:
    condition: and
    conditions:
      - condition: template
        value_template: |
          {{ states("sensor.kiosk_last_updated") | int() > 300 }}
      - condition: or
        conditions:
          - condition: time
            after: '17:00:00'
            before: '09:25:00'
            weekday: 
              - mon
              - tue
              - wed
              - thu
              - fri
          - condition: time
            weekday:
              - sat
              - sun
  action:
    - delay: "00:00:02"
    - service: browser_mod.navigate
      data:
        navigation_path: /kiosk-yaml/0
        deviceID:
          - 67796da9-c098a881
          - bm_ca_kiosk_ipp

I have the time conditions in there because during market hours a second automation sends the kiosk to my stocks page. As a PSA, I’m using this brilliant trick to wake the iPad into guided access mode based on a Hue motion sensor (which I don’t think browser mod can do).

1 Like