Have read the documentation and searched the web.
How can read a file from the local file system say the www folder.
What path do I use for the file?
Thanks David
Have read the documentation and searched the web.
How can read a file from the local file system say the www folder.
What path do I use for the file?
Thanks David
I found it depends a lot on how appdaemon and HA are connected. I started with this simple mod to ‘Hello World’ example and seeing where the output file ended up. I use Docker for both HA and appdaemon, so the path I ended up with is different than this example:
import hassapi as hass
#
# Hello World App
#
# Args:
#
class WriteFile(hass.Hass):
def initialize(self):
output_file = '/conf/myfile.txt'
self.log("Writing to file : " + output_file)
ex_string = "This is my output"
with open(output_file, 'w') as f:
print(ex_string, file=f)
Thanks for your suggestion David.
I can now access the www directory with “/config/www/…” from my appDaemon python file.
Cheers David
This modified hello.py app only seems to be able to make a file inside /config directory. Trying it in /media for example fail to create any file (but doesn’t flag an error in logs). So it seems AppDaemon (as installed from HASIO Supervisor Addon) can only see the /config directory.
import appdaemon.plugins.hass.hassapi as hass
#
# Hellow World App
#
# Args:
#
class HelloWorld(hass.Hass):
def initialize(self):
self.log("Hello from AppDaemon")
with open("/config/hello.txt",'w') as f:
print("AppDaemon root directory", file=f)
self.log("Wrote hello.txt to config directory")