Open tanus10 opened 3 years ago
Hopefully someone else can come along and try to make this work, since I don't have a dual unit nor enough python skills to make it work it would have to be someone else investigating it
In my case, the main AC listed in "Devices[1]" but the configuration path is "/devices/0". And sub AC listed in "Devices[0]" but the configuration path is "/devices/1".
I have create two configuration yaml with simple find and replace from 'samsungrac.yaml'. 'climate_ip_samsungrac_dual_main.yaml' : "Devices.0" => "Devices.1" 'climate_ip_samsungrac_dual_sub.yaml' : "devices/0" => "devices/1"
And create two climate devices in the configuration.yaml with same ip address and token. (config_file is different.)
Problem For certain AC models Samsung is selling, "GET https://IP:8888/devices" returns two separate AC devices values.
Background I have a Samsung AC set, one main AC with WIFI, and the other just connected to the main AC. So one can install two AC's in different rooms with merit of installing only one heat exchanger outside. Smartthings natively supports such configuration too.
(sold as one product with two separate remotes for each AC, but only one outside heat exchanger unit to save energy and space)
Details
If you see the returned JSON above carefully, there are two different sets of device values. device/0 and device/1. Which is actually correct behavior, since it's Dual AC-set model. (You can use 'GET https://IP:8888/devices/0' or 'GET https://IP:8888/devices/1' to have just one set of device status values returned)
The problem is that in Homeassistant, climate_ip attributes are populated by the result of 'GET https://IP:8888/devices' call which contains TWO sets of almost identical JSON values. HOMEASSISTANT is parsing it only once. so Guess which values HOMEASSISTANT is using then? Always the first device's.
Example When I turn on device 0. the default device for climate_ip, HOMEASSISTANT populates attributes with device 1 values which is, for some reason, returned sequentially ahead of device 0. Since device 1 is not turned on, HOMEASSISTANT think the climate device is still Power off, Mode off and so on.
Digging I have tried to put '/0' in the end of
so it would look like,
in samsungrac.yaml without success. It produces bellow error in HOMEASSISTANT.
I think it would solve the problem, if only I could put "/0" or "/1" at the end of
params: { method : 'GET', url: 'https://__CLIMATE_IP_HOST__:8888/devices' }
toparams: { method : 'GET', url: 'https://__CLIMATE_IP_HOST__:8888/devices/0' }
or '/1' then modify all /0 in samsungrac.yaml to /1. Actually, in this way I can separately control both AC's, with two different yamls. I have confirmed that with the same IP and port, '/devices/0' and '/devices/1' are what differentiates two AC's, only tried on/off operation, but I am sure others work too.
I do not have the expertise to find what is causing "jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'Devices'" when I put /0 at the end of json_status params. Please help.
By the way, I think even Google nests and Alexa devices are currently supporting only the first device in this kind configuration.
Update
'GET https://192.168.1.132:8888/devices' gets,
{"Devices":[{"Alarms":[{"alarmType":"Device","code........
'GET https://192.168.1.132:8888/devices/0' gets,
{"Device":{"Alarms":[{"alarmType":"Device","code.....
Note the beginning of the returned JSON, "Devices:[" and "Device:" The structural difference is causing the error on HA run, I guess. How can I fix this?