playSound not working with chromecast

I want to use my Google nest mini to announce the water level in my overhead tank. I have added Google Nest mini as a thing through auto discovery of chromecast binding. In the things page i can see its IP configured as 192.168.xx.xx and its port configured as 8009. The following is what i have configured

I have setup a rule like the following to test the cast.

rule "waterlevel time"
        Time cron "0 44 14 ? * ?"
        playSound("chromecast:chromecast:e0d9cbfe3e3125998ed67430a6207065", "doorbell.mp3")

However on that time, the speaker makes a chime sound and goes offline for 5 mins. Below is what is logged in the events.log


2022-05-17 14:44:01.896 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'chromecast:chromecast:e0d9cbfe3e3125998ed67430a6207065' changed from ONLINE to OFFLINE (COMMUNICATION_ERROR): Unable to load media
2022-05-17 14:44:01.909 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'chromecast:chromecast:e0d9cbfe3e3125998ed67430a6207065' changed from OFFLINE (COMMUNICATION_ERROR): Unable to load media to ONLINE

There are quite a few posts on this forum describing a similar (if not identical) problem. Have you tried any of the solutions described in those posts?

Unfortunately yes. Some of them were for openhab2 and i was not sure if they were relevant.
I have added the entry to services.cfg as most post suggested. In my case it almost looks like openhab is not sending the file to chromecast to play as I can hear some kind of notification music.

I have the exact issue in the below post. But I could not understand the solution stated

can someone interpret please?

I’m not sure that’s the case. In that post, the user was trying to execute playSound from the Karaf console. He was running

smarthome:audio play doorbell.mp3

without having configured a default audio sink. When an audio sink is not specified on the command line, that console command will not work because it tries to use the default audio sink (which is not set). Note that that command is an openhab2 command. In openhab3 it would be

openhab:audio play doorbell.mp3

His “solution” was to include the audio sink on the command line (i.e. chromecast:audio:myCC)

openhab:audio play chromecast:audio:myCC doorbell.mp3

I’ve been using the chromecast binding for a very long time with several Nest Minis. So, I suspect it’s something in your configuration.

I’m curious why you think you need to use the callback URL. Have you configured the callback URL in the binding and in services.cfg? If so, I’m not certain which one will take precedence. Unless you’re running in docker or behind a reverse proxy, I’m not sure why you need to set the callback URL.

My openhab is running on raspberry pi 3. I tried removing the URL from the services file. But the problem exists still.
Is the port 8080 correct? The thing configuration has the port as 8009. Is this expected?
Also when i ran the below command. I just get an error notification sound from the nest. Any help will be greatly appreciated.
openhab> openhab:audio play chromecast:chromecast:e0d9cbfe3e3125998ed67430a6207065 doorbell.mp3

In the callback URL? Yes, it is. That’s because the callback URL is supposed to be the IP address and port number of the openHAB instance.

Yes, this is the port number that the Nest Mini listens on.

Ok, so you removed the callback URL from the services.cfg file. Did you also make sure it is removed from the binding configuration? Confirm by going to the Bindings page in Main UI, then click on the Chromecast binding, then on the Settings icon. The Callback URL field should be empty. If it’s not empty, clear it and then save.

Finally, can you also look at the services.config file in userdata/config/org/openhab directory? Make sure the callback URL doesn’t appear in that file either. If it’s still in there, let me know and I’ll tell you how to remove it.

am unable to remove the callbackurl in the binding. When i delete it and save it, it reappears. Also it saves the values to chromecast.config in bindings folder insider userdata folder. The services.config file you mentioned does not have any settings for callbackURL. Could it be because of Java
Below are my settings from Anything missing?

Also I found another thing: Nest is not going offline. it is simply playing something for a long time. So previously, when the playSound was triggered, I hear a notification sound(not the track) in the nest and it would not accept any further command for 5-6 mins, meaning, it would not play even that notification sound. But now after the notification if i speak “Ok Google, Stop” then I am able to immediately trigger the next playSound(of course just the notification and not the actual track). This suggests me that openhab is not sending the right information to nest for playing.
I doubted my encoding and played the doorbell.mp3. which is also not working.

The fact that you can’t remove the callback URL from the binding config suggests there’s something wrong. I’m sorry, but I really don’t know what is causing the problem.

No problem, thanks for helping. Will fiddle with it for sometime, otherwise, will go for a reinstall…

This is one of the reasons why overconfidence is stupidity. Though you clearly stated ‘That’s because the callback URL is supposed to be the IP address and port number of the openHAB instance.’, I did not read past ‘Yes’ and continued thinking it is set correctly. Actually “callbackUrl” was set with the ip address of chromecast which is WRONG, it should be the IP address of openhab. It does default with the IP Address of the chromecast, which may be wrong. It needs to be the IP Address of openhab server. And it works…

1 Like