I’m trying to cast an image to a chromecast. On the dev-services page, it gives the example of casting a PNG file, but none of the media_content_type values seem to match up (or work). I also tried “picture” and “image” just in case those types weren’t documented. Is there a way to just show an image?
This works apparently:
"media_content_type":"MUSIC"
Yeah, makes perfect sense
I could swear that I tried that, but I’ll give it another go. Thanks!
Nope, this isn’t working. It starts trying to cast something, but I don’t get the image, just the default cast logo in the middle of the screen. The app is running, but it can’t display the media.
It was a year old post. I guess something has been broken between ten and now.
Have you seen this thread, this maybe able to give you some pointers
Yes, very helpful. Looks like this example is using “media_content_type: ‘image/jpg’”. This option isn’t documented anywhere I’ve seen so far. I’ll give it a try. I wonder if other mime type strings would work in this field?
FYI, this totally works!
Interesting, didn’t know you could cast a static image.
Sorry to bump an old thread, but I’m having some difficulty with casting local images from my HA Server to either a Chromecast or Home Hub.
I’m trying to set it so when the doorbell is rang, a snapshot is taken and then this image should be cast. The images is also sent to my phone via Telegram and this works perfectly.
I previously had live video footage of the camera cast, however there is a lot of buffering so figured a snapshot may work better.
Running in to issues with actually casting the images. No problem connecting to the cast devices, however the image will not display.
I can however call the media_player.play_media service and cast web hosted images, just not local images.
# Door Bell
- alias: Doorbell
trigger:
platform: event
event_type: xiaomi_aqara.click
event_data:
entity_id: binary_sensor.switch_158d0002134e55
click_type: single
action:
- service: camera.snapshot
data:
entity_id: camera.porch_ffmpeg
filename: "/tmp/porch.jpg"
- service: notify.notify
data:
message: "The doorbell was rang at {{now().strftime('%H:%M %d-%m-%Y')}}."
data:
photo:
- file: /tmp/porch.jpg
caption: The doorbell was rang at {{now().strftime('%H:%M %d-%m-%Y')}}.
- service: notify.bridget
data:
message: "The doorbell was rang at {{now().strftime('%H:%M %d-%m-%Y')}}."
data:
photo:
- file: /tmp/porch.jpg
caption: The doorbell was rang at {{now().strftime('%H:%M %d-%m-%Y')}}.
- service: xiaomi_aqara.play_ringtone
data:
gw_mac: 78:11:DC:B1:EF:85
ringtone_id: 10
ringtone_vol: 25
- service: media_player.turn_on
entity_id:
- media_player.kitchen_display
- media_player.lounge_max
- media_player.lenovosmartdisplay89835
- media_player.living_room_speaker
- delay:
seconds: 3
- service: tts.google_say
entity_id:
- media_player.kitchen_display
- media_player.lounge_max
- media_player.lenovosmartdisplay89835
- media_player.living_room_speaker
data:
message: 'Somebody is at the Front Door.'
# - service: media_player.play_media
# entity_id:
# - media_player.kitchen_display
# - media_player.chromecast1880
# - media_player.lenovosmartdisplay89835
# data:
# media_content_id: "/tmp/porch.jpg"
# media_content_type: "image/jpg"
# - delay:
# seconds: 30
# - service: media_player.turn_off
# entity_id:
# - media_player.kitchen_display
# - media_player.chromecast1880
# - media_player.lenovosmartdisplay89835
# - media_player.lounge_max
# - media_player.living_room_speaker
# - service: media_player.turn_on
# entity_id: media_player.kitchen_display
# - delay:
# seconds: 3
# - service: camera.play_stream
# data:
# entity_id: camera.porch_ffmpeg
# media_player: media_player.kitchen_display
# - delay:
# seconds: 60
# - service: media_player.turn_off
# entity_id: media_player.kitchen_display
For future reference I believe I’ve solved this now.
Correct media path should be
http://hass_local_ip:8123/local/your_file.format
@chris_avfc, Hi chris, I am looking for similar stuff. I have a Ring doorbell pro (already connected to HA). Do you have guide to achieve what you said above? Thanks.
Hi Henry,
If you scroll up to my post from Oct 9 my automation for the Doorbell is already posted.
Can’t say for certain if it’ll work for a Ring Door Bell Pro though, my set up is a generic FFMPEG Camera & Xiaomi Button Sensor.
If you need further detail let me know.
Hi Chris, I am actually want to know how to setup so when the doorbell is rang, a snapshot is taken and then the images is sent to my phone via Telegram. Thanks!
PS: just realize you probably have different doorbell. I have Ring Doorbell Pro.
That’s what the automation does.
The ‘doorbell’ is an Xiaomi Button Sensor.
The Camera is a generic FFMPEG Camera.
Clicking the Xiaomi Button Sensor, triggers the Doorbell Automation.
The Door bell automation then:
- Triggers a Doobell Tone on various Google Hoems
- Triggers the Camera Snapshot
- Triggers the Telegram Notification including the Snapshot
- Triggers the Snapshot to be cast to a Nest Hub and a Lenovo Smart Display
Got more things to learn. I started HA 3 days ago. Thanks for the patience.
Here’s my full automation that might help?
automation:
- alias: 'Doorbell Actions'
initial_state: true
hide_entity: false
trigger:
- platform: event
event_type: deconz_event
event_data:
id: doorbell_button
event: 1000
# platform: event
# event_type: xiaomi_aqara.click ## Requirement for xiaomi_aqara. added in 0.83.0 ##
# event_data:
# entity_id: binary_sensor.switch_doorbell ## binary_sensor.switch_158d0001562d98 ##
# click_type: single ## long_click_press, long_click_release, hold, single, double ##
action:
- service: xiaomi_aqara.play_ringtone
data:
gw_mac: !secret xiaomi_mac
ringtone_id: 10
ringtone_vol: 30
- service: camera.snapshot
data:
entity_id: camera.front_porch
filename: '/config/www/images/front_porch.jpg'
# Script contains a condition that the TV must be off and that the input_boolean.hik_entry_intrusion #
# must be on. Input Boolean is a visible entitiy in the Entry Door Image on the LL CCTV Tab #
- service: script.turn_on
entity_id: script.stream_door_to_familycc
- service: notify.hass_synochat
data:
message: "The doorbell was pushed at {{ states.sensor.time.state }}"
data:
file_url: "http://ipofhass:8123/local/images/front_porch.jpg"
- service: script.turn_on
entity_id: script.alarm_light_flash_green
- service_template: "{% if is_state('media_player.sony_bravia_tv' , 'on')
%} rest_command.androidtv_doorbell
{% endif %}"
And you must whitelist the directories where you need the images stored. This goes in configuration.yaml.
whitelist_external_dirs:
- /config/www
- /share
Hi Chris,
As a starter on HA I can’t seem to find a full automation as yours.
Cab you share this or where can I find this?
Appreciate the help!