That got things a step further ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=9)
Now I get this error instead in the log:
2018-07-04 18:37:27.657740 INFO AppDaemon: Reloading Module: /config/appdaemon/apps/amlshal.py
2018-07-04 18:37:27.659464 INFO AppDaemon: Loading App Module: amlshal
2018-07-04 18:37:27.663577 WARNING AppDaemon: ------------------------------------------------------------
2018-07-04 18:37:27.664483 WARNING AppDaemon: Unexpected error loading module: /config/appdaemon/apps/amlshal.py:
2018-07-04 18:37:27.665894 WARNING AppDaemon: ------------------------------------------------------------
2018-07-04 18:37:27.671025 WARNING AppDaemon: Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py”, line 1789, in read_app
importlib.reload(self.modules[module_name])
KeyError: ‘amlshal’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py”, line 2015, in check_app_updates
self.read_app(mod[“name”], mod[“reload”])
File “/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py”, line 1794, in read_app
self.read_app(file)
File “/usr/lib/python3.6/site-packages/appdaemon/appdaemon.py”, line 1802, in read_app
self.modules[module_name] = importlib.import_module(module_name)
File “/usr/lib/python3.6/importlib/init.py”, line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 994, in _gcd_import
File “”, line 971, in _find_and_load
File “”, line 955, in _find_and_load_unlocked
File “”, line 665, in _load_unlocked
File “”, line 674, in exec_module
File “”, line 781, in get_code
File “”, line 741, in source_to_code
File “”, line 219, in _call_with_frames_removed
File “/config/appdaemon/apps/amlshal.py”, line 5
def init(…):
^
SyntaxError: invalid syntax
2018-07-04 18:37:27.676830 WARNING AppDaemon: Removing associated apps:
2018-07-04 18:37:27.671935 WARNING AppDaemon: ------------------------------------------------------------
2018-07-04 18:37:27.678350 WARNING AppDaemon: amlshal
Now amlshal.py looks like this
import appdaemon.plugins.hass.hassapi as hass
class advancedMotionLightSensor(hass.Hass):
def init(...):
self.listen_state(self.callback,self.args['input_select'])
self.light_mappings = self.args['lightmapping']
def callback(...):
day_section = self.get_state('sensor.day_interval')
desired_dimval = self.light_mappings[day_section]
self.turn_on(self.arg_switch, brightness_pct = desired_dimval)
But maybe my starting point is wrong. What I basically would like to do, is by using the sensor “Part of day” and if the lux is below 100 I would like entity id: “light.aeotec_zw111_nano_dimmer_level” to go on at movment by the dimlevel specified in the amlshal part of apps.yaml