I decided to try implementing the same functionality for lovelace. But this one works for any html5 browser (I think, I haven’t tried all of them) on your computer or ipad as well.
This replaces the audio-card you may have seen here yesterday. By not making it a card, it will work across all lovelace views.
Uncaught (in promise) DOMException
:8123/local/dual-thermostat/dual-thermostat.js?v=1:1 Failed to load resource: the server responded with a status of 404 (Not Found)
2af5b1c2d5fbf8c18791.chunk.js:5783 Uncaught (in promise) /local/dual-thermostat/dual-thermostat.js?v=1
lovelace-player.js:98 Uncaught TypeError: Cannot read property ‘shadowRoot’ of null
at Object.debug (lovelace-player.js:98)
at lovelace-player-config.js:8
9core-fc6fc737.js:1 WebSocket connection to ‘wss://192.168.1.22:8123/api/websocket’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
s @ core-fc6fc737.js:1
2af5b1c2d5fbf8c18791.chunk.js:5783 Uncaught (in promise) /local/dual-thermostat/dual-thermostat.js?v=1
I call media_player.play_media to media_player.my_floorplan_player (tested successfully first with a different media player [google home]) but nothing happens. I added a few console outputs to the lovelace-player.js file and it does indeed load, but it does not do anything when I call the above service.
For completeness’ sake, here’s what I added to the .js file:
switch (ev.data.service) {
case 'play_media':
case 'media_play':
let src = ev.data.service_data.media_content_id;
if(src)
audio.src = src;
playing = true;
audio.play();
console.info("playing.."); // <---- that line
break;
but that line never shows up (whereas other lines like console.info(Lovelace-player: registered browser to ${myPlayer}, thisScript);
DO show up in the console).
The hassio logfile looks correct though: 2019-04-02 21:23:36 INFO (SyncWorker_16) [custom_components.floorplan_speaker.media_player] play_media: https://xxx.duckdns.org:8123/local/audio/meantime.mp3
Any ideas on what I need to do differently?
Thanks so much!
Oh you brilliant person, you! Thank you. I was about ready to give up… what a stupid typographical error. When you stare at something long enough you just can’t see stuff like that. Thanks again. What a great plugin.
Nice plugin! But what do you mean with " you can add the variable getID=true to the script URL"?
I tried /local/plugins/card-tools.js?getID=true and /local/plugins/lovelace-player.js?media_player.my_floorplan_speaker=somecodegetID=true.
The first one should work. In the second case, you need to separate the variables with an ampersand /local/plugins/lovelace-player.js?media_player.my_floorplan_speaker=somecode&getID=true.
Great plugin! Unfortunately in my case it only works fine on windows based machines!?
I tried hard, but on iOS with Safari and Firefox Browser there is no sound at all. Is there anything to consider?
Oke since my update to 0.92.2 this does not work anymore.
I get
“Integration floorplan_speaker not found when trying to verify its media_player platform”.
Any idea whats the reason? I think something with the new structure of custom_components.