SebuZet / samsungrac

Home Assistant Climate Device for controlling (not only) Samsung AC
64 stars 31 forks source link

unique id not assigned #41

Open mmaccaroni opened 1 year ago

mmaccaroni commented 1 year ago

Hi! I noticed that in the HA front end is not possible to set the climate entities (e.g. by assigning a room or exposing them to voice assistant), because the climate ip entitis do not have a unique ID set. I even tried to assign one via yaml in tne configuration as customization of the etntitis, but the result is the same. What can be done to overcome this?

wifi75 commented 1 year ago

I was about to write the same thing. How can it be done?

misa1515 commented 1 year ago

same issue for other integrations, will help change identifier from IP to MAC, but I not have such knowledge...

stefan-dumitrescu commented 1 year ago

https://github.com/lucadjc/samsungrac The folder from this guy (i owe him many beers) is the solution: In visual studio (in HA) rename the original folder climate_ip from custom components, create a new folder named "climate_ip" and upload the files from the folder in the repo above. Reboot the system and everything works, including the device_id Kudos @lucadjc

lainol commented 1 year ago

https://github.com/lucadjc/samsungrac The folder from this guy (i owe him many beers) is the solution: In visual studio (in HA) rename the original folder climate_ip from custom components, create a new folder named "climate_ip" and upload the files from the folder in the repo above. Reboot the system and everything works, including the device_id Kudos @lucadjc

Changed climate_ip folder for the lucadjc's one... still unique_id error. 2 x samsung_2878 ACs

lucadjc commented 1 year ago

https://github.com/lucadjc/samsungrac The folder from this guy (i owe him many beers) is the solution: In visual studio (in HA) rename the original folder climate_ip from custom components, create a new folder named "climate_ip" and upload the files from the folder in the repo above. Reboot the system and everything works, including the device_id Kudos @lucadjc

Changed climate_ip folder for the lucadjc's one... still unique_id error. 2 x samsung_2878 ACs

did you restart HA?

lainol commented 1 year ago

Yeah, even system restart

lucadjc commented 1 year ago

can you check if the file climate.py under homeassistant\custom_components\climate_ip path has the following statement?

@property
def unique_id(self):
    #if self._unique_id is None and self.rac.unique_id is not None:
    #    _LOGGER.info("About to set unique id {}".format(self.rac.unique_id))
    #    self._unique_id = "climate_ip_" + self.rac.unique_id

    if self._unique_id is None:
        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
lainol commented 1 year ago

Line 252 and ahead of climate.py, correct Thanks for the support :D

lucadjc commented 1 year ago

turn on the logs into configuration.yaml and see into HA logs and please post here the results

lainol commented 1 year ago
 - platform: climate_ip
    config_file: '/config/custom_components/climate_ip/samsung_2878.yaml'
    name: 'Ac Despacho'
    ip_address: '192.168....'
    token: 'xxxx-xxxx-xxxx-xxxx-xxxx'
    cert: 'ac14k_m.pem' #set as '' to skip certificate verification
    mac: 'xxxxxxxxxxxx'
    poll: True
lucadjc commented 1 year ago
 - platform: climate_ip
    config_file: '/config/custom_components/climate_ip/samsung_2878.yaml'
    name: 'Ac Despacho'
    ip_address: '192.168....'
    token: xxxx-xxxx-xxxx-xxxx-xxxx'
    cert: 'ac14k_m.pem' #set as '' to skip certificate verification
    mac: 'xxxxxxxxxxxx'
    poll: True

try to evaluate the property device_id: same as token

lainol commented 1 year ago

same result with device_id: 'token'

Nothing unusual in the logs.

lucadjc commented 1 year ago

change here as following

and post the log results

lainol commented 1 year ago

edited... i'm dumb

lucadjc commented 1 year ago

Have you copied here all the logs? Is the conditioner working? My version in which folder name have you copied it? This is the log of the folder climate_ipbackup

lainol commented 1 year ago

Sorry for the failed log, here is the good one. Both ACs are working but can't change icon or area due the uinque_id thing.

2023-08-30 16:40:40.257 INFO (MainThread) [custom_components.climate_ip.climate] climate_ip: async setup platform 2023-08-30 16:40:40.259 INFO (MainThread) [custom_components.climate_ip.climate] Loading configuration file: /config/custom_components/climate_ip/samsung_2878.yaml 2023-08-30 16:40:40.259 INFO (MainThread) [custom_components.climate_ip.climate] ip_address: 192.168.1.141 2023-08-30 16:40:40.259 INFO (MainThread) [custom_components.climate_ip.climate] token: TOKEN_DESPACHO 2023-08-30 16:40:40.259 INFO (MainThread) [custom_components.climate_ip.climate] device id: TOKEN_DESPACHO 2023-08-30 16:40:40.314 INFO (MainThread) [custom_components.climate_ip.climate] Validate properties: False (False) 2023-08-30 16:40:40.324 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, host: 192.168.1.141:2878 2023-08-30 16:40:40.324 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, token: TOKEN_DESPACHO 2023-08-30 16:40:40.324 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, duid: MAC_DESPACHO 2023-08-30 16:40:40.324 INFO (MainThread) [custom_components.climate_ip.climate] Configuration, cert: /config/custom_components/climate_ip/ac14k_m.pem 2023-08-30 16:40:40.423 INFO (MainThread) [custom_components.climate_ip.climate] Updating state... 2023-08-30 16:40:40.423 INFO (MainThread) [custom_components.climate_ip.climate] Updating getter... 2023-08-30 16:40:40.423 INFO (MainThread) [custom_components.climate_ip.climate] Executing params: {'duid': 'MAC_DESPACHO', 'token': 'TOKEN_DESPACHO', 'host': '192.168.1.141', 'connection_template': '', 'power_template': '{% if value != none %}{% for key, value in device_state.items() %}{% if key == "AC_FUN_POWER" %}{% if value == "Off" %}{% endif %}{% endif %}{% endfor %}{% endif %}', 'value': None, 'device_state': 'unknown'} 2023-08-30 16:40:40.423 INFO (MainThread) [custom_components.climate_ip.climate] Checking power on template: