diff --git a/apps/pv_opt/config/config.yaml b/apps/pv_opt/config/config.yaml index 3726fa1..92d010f 100644 --- a/apps/pv_opt/config/config.yaml +++ b/apps/pv_opt/config/config.yaml @@ -29,7 +29,7 @@ pv_opt: overwrite_ha_on_restart: true redact_personal_data_from_log: true - consumption_history_days: 2 + consumption_history_days: 7 # ======================================== # Plant parameters diff --git a/apps/pv_opt/pv_opt.py b/apps/pv_opt/pv_opt.py index cbcd72d..02f1f44 100644 --- a/apps/pv_opt/pv_opt.py +++ b/apps/pv_opt/pv_opt.py @@ -819,6 +819,7 @@ def _load_args(self, items=None): over_write = self.args.get("overwrite_ha_on_restart", True) change_entities = [] + self.yaml_config = {} self.log("Reading arguments from YAML:") self.log("-----------------------------------") @@ -855,6 +856,7 @@ def _load_args(self, items=None): self.log( f" {item:34s} = {str(self.config[item]):57s} {str(self.get_config(item)):>6s}: value(s) in YAML" ) + self.yaml_config[item] = self.config[item] elif "id_" in item: if min([self.entity_exists(v) for v in values]): @@ -866,6 +868,7 @@ def _load_args(self, items=None): self.log( f" {item:34s} = {str(self.config[item]):57s} {str(self.get_config(item)):>6s}: value(s) in YAML" ) + self.yaml_config[item] = self.config[item] elif self.entity_exists(self.get_default_config(item)): self.config[item] = self.get_default_config(item) @@ -902,6 +905,7 @@ def _load_args(self, items=None): self.log( f" {item:34s} = {str(self.config[item]):57s} {str(self.get_config(item)):>6s}: value in YAML" ) + self.yaml_config[item] = self.config[item] elif min(arg_types[str]): if self.debug: @@ -915,6 +919,7 @@ def _load_args(self, items=None): self.log( f" {item:34s} = {str(self.config[item]):57s} {str(self.get_config(item)):>6s}: value in YAML" ) + self.yaml_config[item] = self.config[item] else: ha_values = [self.get_ha_value(entity_id=v) for v in values] @@ -999,6 +1004,7 @@ def _load_args(self, items=None): self.log( f" {item:34s} = {str(self.config[item]):57s} {str(self.get_config(item)):>6s}: value in YAML" ) + self.yaml_config[item] = self.config[item] elif ( len(values) > 1 @@ -1063,6 +1069,8 @@ def _load_args(self, items=None): self.log("") + self.log(f">>> {self.yaml_config}") + self._expose_configs(over_write) def _name_from_item(self, item): @@ -1146,7 +1154,7 @@ def _expose_configs(self, over_write=True): self.set_state(state=state, entity_id=entity_id) - elif item in self.config: + elif item in self.yaml_config: state = self.get_state(entity_id) new_state = str(self._state_from_value(self.config[item])) if over_write and state != new_state: