mirror of
https://github.com/hassio-addons/addon-appdaemon.git
synced 2025-05-07 04:21:25 +00:00
28 lines
962 B
Diff
28 lines
962 B
Diff
diff --git a/appdaemon/plugins/hass/hassplugin.py b/appdaemon/plugins/hass/hassplugin.py
|
|
index 138aa4d..3862df1 100644
|
|
--- a/appdaemon/plugins/hass/hassplugin.py
|
|
+++ b/appdaemon/plugins/hass/hassplugin.py
|
|
@@ -8,6 +8,7 @@ import pytz
|
|
from deepdiff import DeepDiff
|
|
import datetime
|
|
from urllib.parse import quote
|
|
+import os
|
|
|
|
import appdaemon.utils as utils
|
|
from appdaemon.appdaemon import AppDaemon
|
|
@@ -63,11 +64,15 @@ class HassPlugin(PluginBase):
|
|
|
|
if "token" in args:
|
|
self.token = args["token"]
|
|
+ elif "HASSIO_TOKEN" in os.environ:
|
|
+ self.token = os.environ.get('HASSIO_TOKEN')
|
|
else:
|
|
self.token = None
|
|
|
|
if "ha_url" in args:
|
|
self.ha_url = args["ha_url"]
|
|
+ elif "HASSIO_TOKEN" in os.environ:
|
|
+ self.ha_url = "http://hassio/homeassistant"
|
|
else:
|
|
self.logger.warning("ha_url not found in HASS configuration - module not initialized")
|
|
|