Appdaemon unc paths

Hi all , I am trying to get appdaemon to run a simple python script but having trouble with a remote smb path.
does appdaemon support a statement like
files = os.listdir('//Diskstation/Music/Bedtime/')

cheers Dene

You can run any code you like in AD as long as it’s python!

Thanks for your reply Andrew, I can make it work on a windows python but not on a linux box or appdaemon. I found a work around by just making a list of tracks to play, not hard to up date when I add more tracks, but it works for what I want it to do. here is my script if anyone wants to do the same in home assistant with a Sonos. Cheers Dene

import hassapi as hass
import soco
import random
from soco import SoCo
import datetime

class Sonos(hass.Hass):

def initialize(self):

    time = datetime.time(21, 30, 0)

    self.run_daily(self.play, time)

def play(self, kwargs):

  Sonos = SoCo('192.168.1.203')

  files = ['Guitar chill music.mp3', 'Ocean Music Sleep.mp3', 'Running water.mp3', 'SM_Friday.mp3', 'SM_Monday.mp3', 'SM_Saturday.mp3', 'SM_Sunday.mp3', 'SM_Thursday.mp3', 'SM_Tuesday.mp3', 'Tranic Sexuality.mp3']

  track = random.choice(files)

  uri = 'x-file-cifs://Tower/Music/Bedtime/{}'.format(track)

  Sonos.volume = int(40)

  Sonos.play_uri(uri)

Dont forget to add the soco library in the appadaemon config addon.page

system_packages: []
python_packages:

  • soco
    init_commands: []