Package: openhomedevice
openhomedeviceLibrary to provide an API to an existing openhome device. The device needs to have been discovered first by something like netdisco (https://github.com/home-assistant/netdisco).The underlying UPnP client library used ishttps://github.com/StevenLooman/async_upnp_clientTested againstLinn Products Ltddevices running Davaar 80 (thought expected to work on earlier variants)Tested againstOpenHome PlayerdevicesInstallationpip install openhomedeviceAPIConstructordevice=Device(location)awaitdevice.init()MethodsControlawaitset_standby(standbyRequested)#boolawaitplay()#starts playbackawaitplay_media(track_details)#start playing `track_details`awaitstop()#stops playbackawaitpause()#pauses playbackawaitskip(offset)#positive or negative integerawaitset_volume(volume_level)#positive numberawaitincrease_volume()#increase volume by 1awaitdecrease_volume()#decrease volume by 1awaitset_mute(muteRequested)#boolawaitset_source(index)#positive integer (use Sources() for indices)awaitinvoke_pin(index)#positive integer (use Pins() for indices)Firmwareawaitcheck_latest_firmware()#check for the latest firmwareawaitupdate_firmware()#update the device firmwareawaitsoftware_status()#returns a dictionary with information about the current softwareInformationaluuid()#Unique identifiermanufacturer()#Manufacturermodel_name()#Model Namefriendly_name()#Friendly Nameawaitname()#Name of deviceawaitroom()#Name of roomawaitis_in_standby()#returns true if in standbyawaittransport_state()#returns one of Stopped, Playing, Paused or Buffering.volume_enabled#property true if the volume service is availableawaitvolume_level()#returns the volume setting or None if disabledawaitis_muted()#returns true if muted or None if disabledawaitsource()#returns the currently connected source as a dictionaryawaitsources()#returns an array of source dictionaries with indicesawaittrack_info()#returns a track dictionaryawaitpins()#returns an array of pin dictionaries with indicespins_enabled#property true if the pins service is availableSource Response{'type':'Playlist','name':'Playlist'}Sources Response[{'index':0,'type':'Playlist','name':'Playlist'},{'index':1,'type':'Radio','name':'Radio'},{'index':3,'type':'Receiver','name':'Songcast'},{'index':6,'type':'Analog','name':'Front Aux'}]Pins Response[{'index':1,'title':'Playstation 4','artworkUri':'external:///source?type=Hdmi&systemName=HDMI3'}{'index':4,'title':'Classic FM','artworkUri':'http://cdn-profiles.tunein.com/s8439/images/logoq.png?t=1'}{'index':6,'title':'Chillout Playlist','artworkUri':'http://media/artwork/chillout-playlist.png'}]TrackInfo Response{"mimeType":"http-get:*:audio/x-flac:DLNA.ORG_OP=01;DLNA.ORG_FLAGS=01700000000000000000000000000000","rating":None,"performer":["Fahmi Alqhai, Performer - Johann Sebastian Bach, Composer"],"bitDepth":16,"channels":2,"disc":None,"composer":[],"year":2017,"duration":460,"author":[],"albumArtist":[],"type":"object.item.audioItem.musicTrack","narrator":[],"description":None,"conductor":[],"albumArtwork":"http://static.qobuz.com/images/covers/58/20/8424562332058_600.jpg","track":2,"tracks":None,"artwork":None,"genre":["Klassiek"],"publisher":"Glossa","albumGenre":["Klassiek"],"artist":["Fahmi Alqhai"],"bitRate":None,"albumTitle":"The Bach Album","uri":"http://192.168.0.110:58050/stream/audio/b362f0f7a1ff33b176bcf2adde75af96.flac","discs":None,"published":None,"title":"Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba) : Violin Sonata No. 2 in A Minor, BWV 1003 (Arr. for Viola da gamba): II. Fuga","sampleRate":44100}SoftwareStatus responseWhen an update is available:{"status":"update_available","current_software":{"version":"4.99.491","topic":"main","channel":"release"},"update_info":{"legal":{"licenseurl":"http://products.linn.co.uk/VersionInfo/licenseV2.txt","privacyurl":"https://www.linn.co.uk/privacy","privacyuri":"https://products.linn.co.uk/VersionInfo/PrivacyV1.json","privacyversion":1},"releasenotesuri":"http://docs.linn.co.uk/wiki/index.php/ReleaseNotes","updates":[{"channel":"release","date":"07 Jun 2023 12:29:48","description":"Release build version 4.100.502 (07 Jun 2023 12:29:48)","exaktlink":"3","manifest":"https://cloud.linn.co.uk/update/components/836/4.100.502/manifest.json","topic":"main","variant":"836","version":"4.100.502"}],"exaktUpdates":[]}}When the system is on the latest firmware:{"status":"on_latest","current_software":{"version":"4.100.502","topic":"main","channel":"release"}}Upgrading FirmwareUse this to check if an update is required and then instruct the device to apply itawaitopenhomeDevice.check_latest_firmware()awaitopenhomeDevice.update_firmware()Playing A TrackUse this to play a short audio track, a podcast Uri or radio station Uri. The audio will be played using the radio source of the device. ThetrackDetailsobject should be the same as the one described in theTrackInfosection above.track_details={}track_details["uri"]="http://opml.radiotime.com/Tune.ashx?id=s122119"track_details["title"]='Linn Radio (Eclectic Music)'track_details["albumArtwork"]='http://cdn-radiotime-logos.tunein.com/s122119q.png'openhomeDevice.PlayMedia(track_details)Examplepython3demo.pyRunning TestsPYTHONPATH=.pytest./tests/*Uploading PackageFollowing guide fromhttps://packaging.python.org/tutorials/packaging-projects/Update version insetup.pypython3setup.pysdist
twineuploaddist/*