Smarthome Functionen
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.py 449B

123456789101112131415161718
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. import inspect
  5. class changed_value_indicator(dict):
  6. def __init__(self):
  7. super().__init__(self)
  8. def changed_here(self, topic, key, value):
  9. caller_name = inspect.getmodule(inspect.stack()[1][0]).__name__ + '.' + inspect.stack()[1][3]
  10. key = '::'.join([caller_name, topic, key])
  11. #
  12. rv = self.get(key) != value
  13. self[key] = value
  14. return rv