CastManager

Contains functions that work with Google Chromecasts and Google Home. @see ChromeCast

aaa_modules.cast_manager.findCasts(prefix)[source]

Return a list of ChromeCast. If prefix is UNDEF, NULL, or “ALL”, return all casts. Otherwise returns the matching casts.

Parameters:prefix (StringItem_or_str) –
Return type:list(ChromeCast)
aaa_modules.cast_manager.getAllCasts()[source]

Return all available ChromeCast objects.

Return type:list(ChromeCast)
aaa_modules.cast_manager.getAllStreamNames()[source]

Returns a list of stream names.

Return type:list(str)
aaa_modules.cast_manager.getFirstFloorCasts()[source]

Return the ChromeCast objects on the first floor. :rtype: list(ChromeCast)

aaa_modules.cast_manager.getStreamUrl(name)[source]

Returns the stream associated with the given name.

Return type:str or None if not found
aaa_modules.cast_manager.pause(casts=[<aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>])[source]

Pauses the passed-in chrome cast player.

Parameters:casts (list(ChromeCast)) –
aaa_modules.cast_manager.playMessage(message, casts=[<aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>], volume=50)[source]

Play the given message on one or more ChromeCast and wait till it finishes (up to MAX_SAY_WAIT_TIME_IN_SECONDS seconds). Afterward, pause the player. After this call, cast.isActive() will return False.

If _testMode is True, no message will be sent to the cast.

Parameters:
  • message (str) – the message to tts
  • casts (list(ChromeCast)) –
  • volume (int) – the volume value, 0 to 100 inclusive
Returns:

boolean True if success; False if stream name is invalid.

Raise:

ValueError if volume is not in the 0 - 100 inclusive range, or if message is None or empty.

aaa_modules.cast_manager.playStream(name, casts=[<aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>], volume=None)[source]

Play the given stream url.

Parameters:
  • name (str) – see _STREAMS
  • casts (list(ChromeCast)) –
Returns:

boolean True if success; False if stream name is invalid.

aaa_modules.cast_manager.resume(casts=[<aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>, <aaa_modules.chromecast.ChromeCast instance>])[source]

Resumes playing on the passed-in chrome casts.

Parameters:casts (list(ChromeCast)) –