AlarmSystem with appdaemon

My app supports it as well…
I don’t use this custom component, so I can’t talk from experience.
I don’t know if it is possible to directly configure this in this custom component. As a workaround you could create an input_boolean for each room like input_boolean.bedroom_lux_high, which is ‘on’ if the lux is higher than your threshold and ‘off’ if the lux is lower than your threshold and then use these input booleans as override entities in the custom component.
However, this is not a very clean solution in my opinion.

I completely agree with you … your app is called lightsaver right …I saw u pushed it 14 hours ago but I can’t find any config example for it …would like taking your instead of the custom component …could you provide me a short example how to configure your light component for appdaemon? According to the core I guess it’s exactly what I need … I’m running appdaemon 3 and 4

For them moment I created binary sensors for the luminance values needed for the “condition” … the dev of the custom_component also recommended this … I’ll try this out but might want to try your app also. Just in case it fits better to my needs. The only thing is I’d need a config example :slight_smile:

I think you mean the app of @runningman84. I could check the app and provide you with a config for his app, but it’s easier if he provides you with an example, which I assume he already has one.

You can’t use my motion_lights app alone, you would need to add all the other apps because they are interconnected. I’m working on making my apps usable by other people, but unfortunately not on the top of my priority list.

You are totally right! … why i mixed up you two names? Burningman …burningstone … runningman… …well… I checked his repo but don’t find an example at all.

You are right there is no example on his Github. I thought more that he can provide you an example here in the forum :slightly_smiling_face:

Hi dude @runningman84 . Could you please provide an example how to configure your light automation?

Sorry I will post same sample config this evening.

The new docs are live at my github project.

Just an info… I just left home and the alarm has not been activated by the app… but it recognised again when i change to home… that’s weird

@runningman84
I just saw illumination value is hardcoded in the code

class LightSaver(hass.Hass):

    def initialize(self):
        self.log("Hello from LightSaver")

        # setup sane defaults
        self._motion_sensors = self.args.get("motion_sensors", [])
        self._illumination_sensors = self.args.get("illumination_sensors", [])
        self._device_trackers = self.args.get("device_trackers", [])
        self._lights = self.args.get("lights", [])
        self._vacation_control = self.args.get("vacation_control", None)
        self._guest_control = self.args.get("guest_control", None)
        self._motion_duration = self.args.get("motion_duration", 60*3)
        self._tracker_duration = self.args.get("tracker_duration", 60)
        self._vacation_duration = self.args.get("vacation_duration", 60)
        self._min_elevation = self.args.get("min_elevation", 10)
        self._min_illumination = self.args.get("min_illumination", 15)

can ich change those to:

       self._min_illumination = self.args.get("min_illumination", None)

and put a value in the app-config like this:

light_saver_stairs:
  module: light
  class: LightSaver
  motion_sensors:
    - binary_sensor.motion_sensor_158d000222222
  illumination_sensors:
    - sensor.illumination_158d0001d82f66
  device_trackers:
    - device_tracker.android_phone_bob
  lights:
    - light.hue_office_1
    - light.hue_office_2
  off_scene: scene.office_light_off
  evening_scene: scene.office_light_evening
  night_scene: scene.office_light_night
  vacation_control: input_boolean.vacation_mode
  guest_control: input_boolean.guest_mode
  min_illumination: 30

The illumination is not hardcoded. It tries to get a value from the argument “min_illumination” of the config, if ‘min_illumination’ doesn’t exist in the config it will default to 15.

Check out pythons ‘get’ method for more information.

YOu config did not show the config min_illumination in your example. Sorry i am not a programmer at all and thought i understood the code by reading.

anyway. If I change the value in the py file to 80 … and actually the value of the sensor is 60 … normally it should turn on the light right?

but i get this:

2019-10-04 14:18:04.959098 INFO AppDaemon: Initializing app light_saver_stairs using class LightSaver from module light
2019-10-04 14:18:04.960884 INFO light_saver_stairs: Hello from LightSaver
2019-10-04 14:18:04.962625 INFO light_saver_stairs: Got motion sensors ['binary_sensor.motion_dressing']
2019-10-04 14:18:04.964316 INFO light_saver_stairs: Got device trackers ['device_tracker.phone_thorsten', 'device_tracker.phone_emilie', 'device_tracker.phone_evan']
2019-10-04 14:18:04.965960 INFO light_saver_stairs: Got lights ['light.dressing']
2019-10-04 14:18:04.968642 INFO light_saver_stairs: Got motion duration 180
2019-10-04 14:18:04.970378 INFO light_saver_stairs: Got tracker duration 60
2019-10-04 14:18:04.972040 INFO light_saver_stairs: Got vacation duration 60
2019-10-04 14:18:04.974719 INFO light_saver_stairs: Got 1 device_trackers home and 2 device_trackers not home
2019-10-04 14:18:04.976244 INFO light_saver_stairs: Got guest_mode False
2019-10-04 14:18:04.977765 INFO light_saver_stairs: Got vacation_mode False
2019-10-04 14:18:28.605911 INFO light_saver_stairs: Callback power_on from binary_sensor.motion_dressing:state off->on

nothing else and light won’t turn on

this is my config:

light_saver_stairs:
  module: light
  class: LightSaver
  motion_sensors:
    - binary_sensor.motion_dressing
  illumination_sensors:
    - sensor.luminance_dressing
  device_trackers:
    - device_tracker.phone_thorsten
    - device_tracker.phone_emilie
    - device_tracker.phone_evan
  lights:
    - light.dressing
  off_scene: scene.light_dressing_off
  evening_scene: scene.office_light_evening
  night_scene: scene.office_light_night
  vacation_control: input_boolean.vacation_mode
  guest_control: input_boolean.guest_mode
  min_illumination: 80

and sensor has value:

Again it’s not my app, just trying to help you by reading his code :slightly_smiling_face:
I’m just butting in all the time haha

Do you have a separete log for errors or are they in the same log? If yes, could you check if there are any errors in the error log?

Can you please add the following in line 184 before ‘self.turn_on_lights’:

self.log("No constraint met. Going to turn lights on")

And in line 164 before 'if(self.below_min_illumination…" add:

self.log(self.below_min_illumination)

Then try again and show me the logs please.

1 Like

alarm system dont work with

alarm_control_buttons:
 - binary_sensor.switch_158d00029086fb

no any reactions on single, double or long press

Logs please

1 Like

no reaction even in logs . but in ha state changes when i press a button.

That’s pretty trange. I have similiar problem: Alarmsystem will recognize when device_tracker goes home but not when it goes not_home. I have to “manually” arm my alarmsystem with another automation

To troubleshoot things like this, I suggest adding your own logs at different places in the code to narrow down the place to find the error.
E.g. I would add this in line 69 to see if the button you configured was taken correctly:

self.log(self._alarm_control_buttons)

Could you please show the events in HA when you do the different button presses?

1 Like

like this ?

        self.log("Got alarm state {}".format(self.get_alarm_state()))
        self.log(self._alarm_control_buttons)
        self.listen_state(self.alarm_state_triggered_callback,

with this i got in logs

2019-10-08 14:17:37.637718 INFO alarm_system: ['binary_sensor.switch_158d00029086fb']