Hi
So I’m hoping someone can help me! I have an automation that is triggered via IFTTT whereby I ask Google to ‘show me the DRIVEWAY camera on the KITCHEN TV’ where DRIVEWAY could be one of four cameras and KITCHEN TV can be one of four TVs. To get around this I have four IFTTT Applets - one for each camera, then the TV is the variable within the applet. Both these variables are then passed to the automation:
- alias: chromecast_camera
initial_state: on
trigger:
platform: event
event_type: ifttt_webhook_received
event_data:
action: call_service
action:
- service: media_player.play_media
data_template:
entity_id: >
{% if (trigger.event.data.textfield == 'the bedroom') %}
media_player.bedroom_tv
{% elif (trigger.event.data.textfield == 'the family room') %}
media_player.family_room_tv
{% elif (trigger.event.data.textfield == 'the kitchen') %}
media_player.kitchen_tv
{% elif (trigger.event.data.textfield == 'the living room') %}
media_player.living_room_tv
{% endif %}
media_content_id: >
{% if trigger.event.data.camera == 'cam-driveway' %}
https://CAMERAURL
{% elif trigger.event.data.camera == 'cam-garage' %}
https://CAMERAURL
{% elif trigger.event.data.camera == 'cam-pippa' %}
https://CAMERAURL
{% elif trigger.event.data.camera == 'cam-sadie' %}
https://CAMERAURL
{% elif trigger.event.data.camera == 'bedrooms' %}
https://CAMERAURL
{% elif trigger.event.data.camera == 'all' %}
https://CAMERAURL
{% endif %}
media_content_type: 'image/jpg'
The problem I have is that when the camera streams are played on the chromecasts they have a state of ‘paused’. I’m not sure why this happens, I’m guessing it is because it is only a webpage the chromecast doesn’t recognise it as a ‘playing’ video. I have Google this separately but didn’t managed to get anywhere (using Blue Iris for the cameras). After a period of time (~10-15 minutes) the chromecast will turn off and the stream will end.
My way to solve this would be to loop the automation so it runs x number of times. The stream would then keep being recast every say 10 minutes before it would switch off. Then it would end after say 1 hour (usually they just show babies napping).
I have read that this might work with a script being set to repeat but I am a bit confused with how the two variables can be passed at the same time as the repeating function would need to either perform the same logic as the initial automation or re-use the same two variables every time it repeats.
Anyways, if anyone can offer any advice on how to do this it would be appreciated!
Cheers