i try to get a habapp rule work but i am lost. i create for each shutter in my home one instance of the class ‘Shutter’ (i want to control each shutter separately to be able to enable / disable opening and closing, sun protection, … for each shutter separately).
my shutters shall be closed when dusk, so i added this event. most shutters only get the command DOWN so it is easy. but some shutters shall close with spezial commands, therefore i created another class that is called then.
my problem is that wenn i call the ‘evening_close()’ via
self.run.on_sun_dusk(self.__check_evening_close)
then the
self.run.countdown(5, self.close_iBalkon_Ro_body).reset()
will never start. if i call it direct like
self.evening_close()
then it works as espected
this is my code (cleared easy):
class Shutter(HABApp.Rule):
def __init__(self):
super().__init__()
self.log = logging.getLogger('My_HABApp')
# this calls 'close_iBalkon_Ro' but the countdown there does not call close_iBalkon_Ro_body
self.run.on_sun_dusk(self.evening_close)
# this also does not work
# self.run.soon(self.evening_close)
# but this works:
# self.evening_close()
def evening_close(self):
self.log.debug('### evening_close started ###')
self.shutter_name = 'iBalkon_Ro'
getattr(ShutterSpecial(), "close_" + self.shutter_name)()
class ShutterSpecial(HABApp.Rule):
def __init__(self):
super().__init__()
self.log = logging.getLogger('My_HABApp')
self.log.setLevel(10) # 10 = debug / 20 = info / 30 = warning
# *********************************************************************************************
# Closing-Spezial für iBalkon_Ro
# *********************************************************************************************
def close_iBalkon_Ro_body(self):
self.log.debug('Shutter: Closing-Spezial iBalkon_Ro start close_iBalkon_Ro_body')
def close_iBalkon_Ro(self):
self.log.debug('Shutter: Closing-Spezial für iBalkon_Ro gestartet')
self.run.countdown(5, self.close_iBalkon_Ro_body).reset()
Shutter()
any hints would be appreciated.