bob1de / hass-apps

Some useful apps and snippets to empower Home Assistant and AppDaemon even more.
Apache License 2.0
86 stars 23 forks source link

AppDaemon 4.0.0b1: Incorrect callback signature #36

Closed bachya closed 5 years ago

bachya commented 5 years ago

I recently upgraded to AppDaemon 4.0.0b1 and noticed this line after one of my watched entities change state:

2019-08-31 19:34:56.047253 INFO outdoor_lights_schedule: --> Attribute 'state' of 'sun.sun' changed from 'above_horizon' to 'below_horizon', reevaluating 2 rooms.
2019-08-31 19:34:57.077349 WARNING AppDaemon: Incorrect signature type for callback _reevaluation_cb() in outdoor_lights_schedule, should be f(self, kwargs) - discarding

FWIW, this is my app configuration:

outdoor_lights_schedule:
  module: hass_apps_loader
  class: SchedyApp
  constrain_input_boolean: input_boolean.outdoor_lights_schedule_automation

  actor_type: switch

  expression_environment: |
    def is_sun_down():
      return state("sun.sun") == "below_horizon"

  rooms:

    backyard:

      actors:
        switch.backyard_lights:

      rescheduling_delay: 0

      schedule:
        - v: "on"
          rules:
            - x: "Skip() if is_sun_down() else Break()"
            - {start: "17:00", end: "21:30", weekdays: "1-4, 7"}
            - {start: "17:00", end: "23:00", weekdays: 5-6}
        - v: "off"

    front_and_kitchen_patios:

      actors:
        group.patio_lights:

      rescheduling_delay: 0

      schedule:
        - v: "on"
          rules:
            - x: "Skip() if is_sun_down() else Break()"
            - {start: "17:00", end: "23:00"}
        - v: "off"

  watched_entities:
    - sun.sun
bachya commented 5 years ago

Reference: https://github.com/home-assistant/appdaemon/issues/462

bob1de commented 5 years ago

This is now fixed in upstream AppDaemon and will be in the next beta.