Skip to content

Commit

Permalink
fixed unique_id settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Costante committed Aug 16, 2023
1 parent 9f4cd26 commit 60fbf55
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"ExpandedNodes": [
"",
"\\.github\\workflows",
"\\custom_components",
"\\custom_components\\climate_ip"
],
"SelectedNode": "\\custom_components\\climate_ip\\manifest.json",
"SelectedNode": "\\custom_components\\climate_ip\\climate.py",
"PreviewInSolutionExplorer": false
}
Binary file modified .vs/samsungrac/v17/.wsuo
Binary file not shown.
Binary file modified .vs/slnx.sqlite
Binary file not shown.
6 changes: 3 additions & 3 deletions custom_components/climate_ip/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def __init__(self, rac_controller, config):
_LOGGER.info("self._name: {}".format(self._name))

self._poll = None
self._unique_id = None
self._unique_id = self._name
_LOGGER.info("self._unique_id: {}".format(self._unique_id))
str_poll = config.get(CONFIG_DEVICE_POLL, "")
if str_poll:
str_poll = str_poll.lower()
Expand Down Expand Up @@ -255,11 +256,10 @@ def unique_id(self):
# self._unique_id = "climate_ip_" + self.rac.unique_id

if self._unique_id is None:
name_value = self._name #config.get(CONF_MAC, None) #self._cfg.duid
name_value = self._name
_LOGGER.info("About to set unique id {}".format(name_value))
self._unique_id = "climate_ip_" + name_value


_LOGGER.info("Returning unique id of {}".format(self._unique_id))
return self._unique_id

Expand Down
6 changes: 4 additions & 2 deletions custom_components/climate_ip/controller_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def __init__(self, config, logger):
self._retries_count = 0
self._last_device_state = None
self._poll = None
self._unique_id = None
self._unique_id = self._device_id
self._uniqe_id_prop = None

@property
Expand Down Expand Up @@ -275,7 +275,9 @@ def update_state(self):
self._attributes['AC_ADD2_OPTIONCODE'] = json_data['AC_ADD2_OPTIONCODE']
self._attributes['AC_ADD2_USEDTIME'] = json_data['AC_ADD2_USEDTIME']
self._attributes['AC_ADD2_FILTER_USE_TIME'] = json_data['AC_ADD2_FILTER_USE_TIME']
self._attributes['last_sync'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

if(len(json_data['AC_ADD2_OUT_VERSION']) != 0):
self._attributes['last_sync'] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
except:
self._logger.info("Error: update_state")

Expand Down

0 comments on commit 60fbf55

Please sign in to comment.