DaveGut / HubitatActive

Hubitat Environment Developments
64 stars 87 forks source link

Update KasaIntegrationApp.groovy #3

Closed Lumute closed 3 years ago

Lumute commented 3 years ago

When a device is not local (in a different subnet from the hub) the resp.mac = null which is normal as communication with devices in other subnets is done through the Gateway. Due to this, in order to set the DNI is necessary to get the MAC from the cmdresp instead. The tools page also has the same issue, the devices array is updated with current IPs for all devices when this app is loaded so in the tools page it is safe to match the device by IP instead which makes it compatible with both local and non-local devices. Also fixed a couple of typos and logging inconsistencies.

DaveGut commented 3 years ago

See several areas where your fix will break other devices. I will attempt to integrate; however, it will take a little time. (PS - can not use IP for search when several devices are at same IP for multi-plug.

Lumute commented 3 years ago

Ah!, I don't have one of those so I didn't look a that part of the code, didn't notice that you are appending mac+plugNumber as the DNI for those... You are right, this will break it. Sorry I wanted to help but don't have any way to test that...

No worries, the code I have works well for me at the moment so there is no hurry, I would like to eventually go back to your main branch as you do a great job at supporting this but there is no hurry.

The only thing is that your current version adds the possibility to use a custom subnet but that does not work as is so other users may have trouble if they use anything other than the hub's subnet. If the first change on the main page where the mac is taken from cmdresp is ok for all devices then you could accept that one and at least the main functionality will work.

DaveGut commented 3 years ago

Understand. I will update in the next week. I have been distracted by the Samsung TV Control I have been developing.

DaveGut commented 3 years ago

Updated to 5.3.5 to integrate your code recommendations except in the method parseDeviceData. Because bulbs return different labels for the MAC (plugs/switches use cmdResp.mac (with colons) while bulbs use cmdResp.mic_mac (no colons). Other than that, your code was great. Thanks.