DaveGut / HubitatActive

Hubitat Environment Developments
64 stars 87 forks source link

Kasa Plugs (3 of 5 total) won't work today.. #24

Closed Valorguy44 closed 2 years ago

Valorguy44 commented 2 years ago

I have 5 total Kasa plugs. They were added last night and all 5 seemed to work ok. Looks like the 2 that I can control through Hubitat desktop screen and through the app are the ones that show "LAN" connection. They were all 5 found from cloud install, and I didn't change any variables. They worked last night (all of them)

The 3 that do not work today are model HS103 (mini plugs). Logs say "6.6.0: sendKasaCmd: Cloud interface not properly set up." However, the cloud is finding them when I go back to my user ID and PW and get a new token.

They show - Current States commsError : false connection : CLOUD led : on switch : on

The 2 that do work are HS100 (Larger appliance plugs). They show - Current States commsError : false connection : LAN led : on switch : on

I do not have "Use Kasa cloud for device control on for any of them. I have "Kasa" cloud binding on for all of them...

ANY ideas on what to do here? Thanks in advance

DaveGut commented 2 years ago

You need to do a Lan install from the app . this will up dat the up addresses.

Note the primary install should be Lan. You would only use cloud if the Lan install did not find a device. See the instructions help.

Valorguy44 commented 2 years ago

Sorry - I am new as of 2 days on Hubitat... Do I remove one and then try to find the IP address assigned by my router- then set it up using lan?

I found all of these by using the cloud method (all 5) - so confused as to why 3 shows cloud and 2 lan...

One plug is offsite at another address - so I'm assuming I will not be able to use this method, since on another LAN at another address?

Thank you for your help

Basement AC Condensate pump 1 - HS100: [192.168.1.143:9999, -29, 6.6.0, Yes] Dehumidifier/Condensate 2 Plug - HS100: [192.168.1.50:9999, -34, 6.6.0, Yes] Helium -MTN Brook - HS103: [CLOUD:CLOUD, -52, 6.6.0, Yes] Helium Power - Unity - HS103: [CLOUD:CLOUD, -54, 6.6.0, Yes] Wink plug in - basement - HS103: [CLOUD:CLOUD, -16, 6.6.0, Yes]

On Thu, Jul 7, 2022 at 8:46 AM David Gutheinz @.***> wrote:

You need to do a Lan install from the app . this will up dat the up addresses.

Note the primary install should be Lan. You would only use cloud if the Lan install did not find a device.

— Reply to this email directly, view it on GitHub https://github.com/DaveGut/HubitatActive/issues/24#issuecomment-1177556771, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ6QCGU2B3TXGI33EJVPKZDVS3GR5ANCNFSM524CXMAA . You are receiving this because you authored the thread.Message ID: @.***>

DaveGut commented 2 years ago

Doing a cloud install will not get IP addresses and assigns added devices to cloud control. This has undergone extensive. I don't know what transpired. Make sure you have static up address for your devices. Other your router can change and th Hubitat device will not have the correct up addresses.

Try running a save preferences on one of the devices and see if that corrects the issue. Then set static up addresses on your router.

If that does not work, run the app default install then exit w/o installing. That should also solve the issue.

I can't do any testing intro Saturday. In hospital.

Valorguy44 commented 2 years ago

I tried saving the preferences again. I also removed one of the "cloud" devices above and re-installing using the LAN method with my IP address. It did find the HS103 plug but then again it set it to "cloud". I have matched all of the settings on the HS100 plugs above to the 3 HS103 to see if I could get them to say "Lan" instead of "cloud", but just cannot do it.

Would you think I should try and remove each one from Hubitat again and then re-discover using LAN method and just see what happens, or is there something more i should do?

Thanks again

DaveGut commented 2 years ago

Some notes:

So one of those two conditions are happening. Which one???????

If the first (IP ADDR = CLOUD, you need to assure the Kasa Credentials in the app are correct and you get a new token.

IF the second, you need to deselect preference useKasaCloud and continue.

def setCommsType(bindState) {
    def commsType = "LAN"
    def cloudCtrl = false
    if (getDataValue("deviceIP") == "CLOUD") {
        commsType = "CLOUD"
        cloudCtrl = true
    } else if (bindState == false && useCloud == true) {
        logWarn("setCommsType: Can not use cloud.  Device is not bound to Kasa cloud.")
    } else if (bindState == true && useCloud == true && parent.kasaToken) {
        commsType = "CLOUD"
        cloudCtrl = true
    } else if (altLan == true) {
        commsType = "AltLAN"
        state.response = ""
    }
    def commsSettings = [bind: bindState, useCloud: cloudCtrl, commsType: commsType]
    device.updateSetting("bind", [type:"bool", value: bindState])
    device.updateSetting("useCloud", [type:"bool", value: cloudCtrl])
    sendEvent(name: "connection", value: "${commsType}")
    logInfo("setCommsType: ${commsSettings}")
    if (getDataValue("plugNo") != null) {
        def coordData = [:]
        coordData << [bind: bindState]
        coordData << [useCloud: cloudCtrl]
        coordData << [connection: commsType]
        parent.coordinate("commsData", coordData, getDataValue("deviceId"), getDataValue("plugNo"))
    }
    pauseExecution(1000) 
} 
stangle commented 2 years ago

First, thanks for making such an excellent app! I read through this thread and I hope you are now out of the hospital and in good health.

It seems the Kasa did something on their end to make HE users have problems. It was about 2 weeks ago that the tokens were disappearing within 24-72 hours. I fought with this for about 3 hours (adding, deleting, and testing devices).

I recall being able to add the [static] IP of a device, but that field is now gone in the latest HE. That said, somehow I have 2 bulbs with IP addresses and 2 (of the same bulbs) that needed to be added by the cloud.

Once a device was added to the Kasa app and functional, I tried the the manual adding of the device in HE (via it's static IP) and it was not found, so I was forced to use the cloud. I can understand that this would vary from device to device, but I have 4 of the same device and 2 required the cloud. 2222

Ideally, I'd like to have everything controlled by IP. If possible, could you point me where I should be looking for this?

Thanks for your time.

DaveGut commented 2 years ago

First: I am working on a fix to the cloud; however, I am not optimistic. The folks over at Homey have the exact same issue.

LAN Questions:

Unfortunately, some routers have settings that impact discovery using this integration. It is usually related to security settings, or the new IP 6 settings. Additionally, some of the new Kasa Devices go into a deep sleep and waking them takes several seconds (outside the timeout period), so they are not discovered.

Things to try for LAN discovery of hard products: If devices are not discovered on the lan:

Final note: be aware that on LAN problems, I can not duplicate and logging is rather worthless. If this helps, please tell me.

Dave

stangle commented 2 years ago

Thanks for working on a fix. For most of my issues, I was able to resolve with physically swapping devices (Tasmota for Kasa or moving a bulb and editing the triggers). Alexa can use the Zooz motion detectors, but not the Zooz switches (ZEN34), it seems) (I might try running Home Assistant from the server to fix this).

I should note that there have been 3-4 Hubitat platform updates during this time as well. I'm on 2.3.2.141.

Are devices on the same IP segment. All have been assigned static IPs. I have no wifi 6 devices. My router is an Asus RT-AC88U (running the latest Merlin firmware). The 5 and 2.4 are split into separate networks.

Here's my ping times: Kitchen Sink: [ip:192.168.1.222, min:1.365, max:14.184, success:100] Basement: [ip:192.168.1.151, min:1.319, max:2.563, success:100]

I followed your instructions (exactly - as well as clicking Add Device to the Device Array before clicking Next). Same result. Again, your software was working flawlessly (until it didn't): TP Link or Hubitat jacked something up. Let me know if I can be of any assistant with testing. There are certain parts of the house that I can mess with that won't make my wife angry. :)

Again, thanks for your time,

Rob

DaveGut commented 2 years ago

This update should fix your issue; however, since it occurs only every 2 or three days, testing was not extensive. Please confirm (three or four days) and close or further comment.

Version 6.6.1 Update Available

Issues addressed:

Update:

stangle commented 2 years ago

This is working flawlessly. Thank you!

DaveGut commented 2 years ago

Closing as a closed issue. Thanks.