Sonos Speaker TTS (Text to Speech) Fails

Error: java.lang.NullPointerException: Cannot invoke method toInteger() on null object (speak)

So this was working for a couple days. Now, its broke. Only thing interesting event since it was working was I had to power cycle my network (switch, router, AP's, etc).

I've isolated the issue down to this:

  • A sonos speaker can play a track via a notification rule in Hubitat
  • The same sonos speaker (actually all 6 of them) cannot use Text to Speech.
  • The Device UI page on Hubitat says the status of the speaker is stopped and shows no other details.

Things I've tried:

  • Removing the speaker.
  • Restarting the speaker (power cycle)
  • Removing all sonos speakers and re-adding
  • Disabling all other rules involving sound or sonos speakers.

I enabled debug logging and performed the following:

  1. Open a door that causes the notification rule to play a track on the Sonos speaker [SUCCESS]
  2. Use the device UI in Hubitat with Text: "test" and Volume Level: "50" and click the Speak button [FAILURE]

Resulting Log (read from bottom up). First line is where it fails to try Text to Speech via the Device Speak button.

dev:692021-06-04 03:39:29.982 pm errorjava.lang.NullPointerException: Cannot invoke method toInteger() on null object (speak)

dev:42021-06-04 03:38:59.129 pm debugSunroom Door is closed

dev:42021-06-04 03:38:59.126 pm debugSunroom Door is closed

dev:692021-06-04 03:38:59.060 pm debugparse description:mac:7828CA027292, ip:c0a801b3, port:578, headers:SFRUUC8xLjEgMjAwIE9LDQpDT05URU5ULUxFTkdUSDogMjQwDQpDT05URU5ULVRZUEU6IHRleHQveG1sOyBjaGFyc2V0PSJ1dGYtOCINCkVYVDogDQpTZXJ2ZXI6IExpbnV4IFVQblAvMS4wIFNvbm9zLzYzLjItODkyNjAgKFpQUzEzKQ0KQ29ubmVjdGlvbjogY2xvc2UNCg==, body:PHM6RW52ZWxvcGUgeG1sbnM6cz0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iIHM6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbmNvZGluZy8iPjxzOkJvZHk+PHU6UGxheVJlc3BvbnNlIHhtbG5zOnU9InVybjpzY2hlbWFzLXVwbnAtb3JnOnNlcnZpY2U6QVZUcmFuc3BvcnQ6MSI+PC91OlBsYXlSZXNwb25zZT48L3M6Qm9keT48L3M6RW52ZWxvcGU+

dev:692021-06-04 03:38:59.047 pm debugparse description:mac:7828CA027292, ip:c0a801b3, port:578, headers:SFRUUC8xLjEgMjAwIE9LDQpDT05URU5ULUxFTkdUSDogMjY2DQpDT05URU5ULVRZUEU6IHRleHQveG1sOyBjaGFyc2V0PSJ1dGYtOCINCkVYVDogDQpTZXJ2ZXI6IExpbnV4IFVQblAvMS4wIFNvbm9zLzYzLjItODkyNjAgKFpQUzEzKQ0KQ29ubmVjdGlvbjogY2xvc2UNCg==, body:PHM6RW52ZWxvcGUgeG1sbnM6cz0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbnZlbG9wZS8iIHM6ZW5jb2RpbmdTdHlsZT0iaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvc29hcC9lbmNvZGluZy8iPjxzOkJvZHk+PHU6U2V0QVZUcmFuc3BvcnRVUklSZXNwb25zZSB4bWxuczp1PSJ1cm46c2NoZW1hcy11cG5wLW9yZzpzZXJ2aWNlOkFWVHJhbnNwb3J0OjEiPjwvdTpTZXRBVlRyYW5zcG9ydFVSSVJlc3BvbnNlPjwvczpCb2R5PjwvczpFbnZlbG9wZT4=

dev:42021-06-04 03:38:58.894 pm debugSunroom Door is open

dev:42021-06-04 03:38:58.890 pm debugSunroom Door is open

The debug logs clearly indicate that Hubitat is talking to your Sonos speaker - at the IP address

Can you confirm that you have internet access? If the TTS you are attempting to send has not been previously cached than Hubitat will need internet access to encode it first.

Also, have you tried restarting your Hubitat?


So there was something off with my DHCP Reservation. After restarting the hub, I checked my router and didn't see the hub. I still had control of via LAN IP/browser UI. I clicked "switch to DHCP" and it seemed to resolve the reservation and popped up on my router again.

The sonos speaker definitely has internet access (can play live internet content).

I'm not sure how to check if my hub has outbound internet access. I went into the networking page and ran a speed test, I think it was successful:

--2021-06-04 21:50:32--
Resolving, 2607:f0d0:3006:6c::4
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11536384 (11M) [application/zip]
Saving to: '/dev/null'

 0K ........ ........ ........ ........ ........ ........ 27% 6.18M 1s

3072K ........ ........ ........ ........ ........ ........ 54% 11.2M 1s
6144K ........ ........ ........ ........ ........ ........ 81% 11.2M 0s
9216K ........ ........ ........ ........ 100% 11.0M=1.2s

2021-06-04 21:50:34 (9.15 MB/s) - '/dev/null' saved [11536384/11536384]

I tried the Speak button on the Sonos Device - didn't work. Tried again after 5min - SUCCESS!

Not sure what caused this, other than a network outage. Would be really good to be able to alert myself if it losses internet connectivity.

1 Like