Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- testing_2:
- module: test_2
- class: Test
- testing:
- module: test
- class: Test
- dependencies:
- - testing_2
- """
- # First App
- import appdaemon.plugins.hass.hassapi as hass
- class Test(hass.Hass):
- def initialize(self):
- pass
- def setup_run_in(self):
- handle = self.run_in(self.cb, 5)
- return handle
- def cb(self, kwargs):
- self.logger.log('cb() was called in testing_2.')
- # Second App
- import appdaemon.plugins.hass.hassapi as hass
- class Test(hass.Hass):
- def initialize(self):
- self.listen_state(self.test, 'input_boolean.appdaemon_testing')
- self.testing_2 = self.get_app('testing_2')
- self.handle_test = None
- self.should_cancel = False
- def test(self, entity, attribute, old, new, kwargs):
- self.log('test() called')
- if self.should_cancel:
- self.cancel_timer(self.handle_test)
- self.log('Cancel self.handle_test.')
- else:
- self.should_cancel = True
- self.handle_test = self.testing_2.setup_run_in()
- self.log('Setup run_in.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement