Use IKEA TRADFRI Motion Sensor to activate cast of dashboard on Google Nest Hub


I’m lost. I have a script that was doing well to cast a dashboard on my google nest hub.

alias: Cast Dashboard Test
  - service: cast.show_lovelace_view
    metadata: {}
      entity_id: media_player.nest_fr
      dashboard_path: lovelace
      view_path: test
mode: queued
icon: mdi:tablet-dashboard

The issue is that the dashboard disappears after a while. So I browse the forum and found people using motion sensor to trigger the script… It looks fine and worked fine for me for the first execution.

alias: DashDisplay
description: ""
  - type: motion
    platform: device
    device_id: e20dfb5853dd6986d97784911e5cc8d8
    entity_id: 1fed900387b29a3390669bba050ae338
    domain: binary_sensor
condition: []
  - service: script.cast_dashboard_test
    data: {}
mode: single

But then it stopped… It seems that when the automation kick in it does not only put the dashboard on it turn it off also on the next motion detection…

Now I cannot even execute the script alone… It runs but nothing happen…

Anyone to point me on what I did wrong?


I have never used the cast service but i do use the media_player.play_media service to send a camera stream to a google nest device when motion is detected.

I remember during my testing of that automation & scripts i found that there seems to be a pre-defined amount of time the casting would remain active before it ended naturally. So in the end, for me, the answer was have two scripts, one to start the cast & one to end the cast after my preferred amount of time. I am initiating the cast start & stop scripts from an automation.

Could be something to look at.


I am really a newbie here but how do I stop the script?

To stop the cast use service: media_player.turn_off