kevinkk525 / pysmartnode

Micropython Smarthome framework
MIT License
116 stars 22 forks source link

STORAGE State Attributes #21

Closed palmtreefrb closed 4 years ago

palmtreefrb commented 4 years ago

First, I want to say what you have done to implement this mqtt solution is fantastic. Thanks... Can you explain what the state storage attributes are to be used for?

Thanks, Rick

kevinkk525 commented 4 years ago

Thanks. What state storage attributes? Can you link me to those?

palmtreefrb commented 4 years ago

Sorry, used in your Climate component... pysmartnode/components/devices/climate/definitions.py

STORAGE_AWAY_TEMPERATURE_LOW = "_a_temp_l"
STORAGE_AWAY_TEMPERATURE_HIGH = "_a_temp_h"
STORAGE_TEMPERATURE_LOW = "_temp_l"
STORAGE_TEMPERATURE_HIGH = "_temp_h"

pysmartnode/components/devices/climate/__init__.py

self.state = {TEMPERATURE_TARGET_HIGH: temp_high,  # current temperature high
              TEMPERATURE_TARGET_LOW: temp_low,  # current temperature low
              AWAY_MODE_STATE: AWAY_OFF,  # away mode "ON"/"OFF"
              STORAGE_AWAY_TEMPERATURE_HIGH: away_temp_high,  # away temperature low
              STORAGE_AWAY_TEMPERATURE_LOW: away_temp_low,  # away temperature high
              STORAGE_TEMPERATURE_HIGH: temp_high,  # temperature high, storage value
              STORAGE_TEMPERATURE_LOW: temp_low,  # temperature low, storage value
              CURRENT_MODE: str(self._modes["off"]),
              CURRENT_ACTION: ACTION_OFF}
kevinkk525 commented 4 years ago

Ah these attributes. They are used to store the state of the climate component. They are implemented this way to make it easier to restore them from a single retained mqtt message after the device gets restarted.

palmtreefrb commented 4 years ago

wow, quick reply... you must be bored at home because of covid19 ;-|

kevinkk525 commented 4 years ago

:D I'm never bored but I am working through all notifications, emails and messages ;)