I’m using HA primarily by casting views to Google Hubs, which has been working great overall. My ‘home’ screen is a picture-elements panel view with my floorplan:
But the only method I’ve found to automatically display live video when a camera is triggered is by casting a view with an iFrame. I’ve cobbled this together using jaradM’s custom grid-layout:
But the appearance isn’t as consistent as I’d like. Does anybody know of a way to embed an iFrame within a picture-elements panel view – or otherwise display live video in picture-elements views on cast devices?
So I ended up going around it all and just making a custom card. So odd, was very easy to do that way. Let me know if you want it I can put it on GitHub?
I’ve done some basic JavaScript editing (and I’m trying to learn more), but creating a custom card from scratch is well beyond my current skill level. I was skeptical of how well this would work, especially with HA’s very finicky Cast component, but it’s working flawlessly; you did a fantastic job! Thank you again.
Hi, just need some help for a noob.
I tried to use the custom-iframe card as explained in lukevink Github and also jparthum but I got always the same message on mi picture-card–> Custom element doesn’t exist: custom-iframe.
This is what I’ve done:
1.-Download and copy custom-iframe-card.js into /www/js (also tried copying in www, also in the same dir as my ui-lovelace.yaml)
2.- Edit my ui-lovelace.yaml and add js as a resource
3.- Add to my card (inside ui-lovelace.yaml) the custom-iframe
But… no result at all, All I got is a big red frame with the msg … custom-iframe doesn’t exist
Here is my code. (ui-lovelace.yaml)
Identation should not be the problem (no errors at editor)
Hi, @golfusderoma. The code you posted looks correct to me assuming you’re in YAML mode. But if you’re in IU mode you’ll need to add it there instead by going to “Configuration” > “Lovelace Dashboards” > “Resources” (at the top) and clicking the “+” button (bottom right).
If you are in YAML mode but haven’t added any custom cards before, you may need to add the whitelist_external_dirs entry to your configuration.yaml file under the homeassistant: key.
As a side note (if you are in YAML mode): You may want to go ahead and move your resources: section to configuration.yaml to avoid a future breaking change, and also change them all to type: module as type: js is being deprecated too.
Hi, Jason, thank you very much for your time. Yes, I am in Yaml mode. And I got it working fine after a “hard reset” to my RPI4. Now it is working like a charm. Thanks again.
I will look at the whitelist matter and move my resources.
They reference mostly custom images that I host locally (lots of dependencies), plus my automations/scenes/sensors/etc. are controlled from Node-RED, so I’m not sure how helpful my code would be.
The .yaml for my home screen is about 1700 lines and each camera screen is around 500 lines. I had planned on trying to consolidate the code (much is duplicated) but between the unreliability of initiating cast sessions and Google now limiting display times on our *their hubs, I’ve unfortunately had to abandon the use of these screens so I’ve stopped further development.
Here are some snippets though that may be enough to work from…
The camera screen shown above begins:
You just need to be sure your top images are listed after your bottom images (IE: the last image to load will appear ‘in front’ of the previously loaded images).
I called the cast.show_lovelace_view service when a camera/motion sensor was triggered, so all of the cast devices could stream the feed simultaneously (using input_booleans to block specific devices when the stream was unwanted; such as no presence detected in device area, other content already casting, etc.). This is the same service that initiates a cast, but when subsequently called with a different view_path specified it just navigates immediately to that View rather than stopping and restarting the cast session.