Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Valorguy44 opened this issue Jul 7, 2022 · 11 comments
Closed

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

Valorguy44 opened this issue Jul 7, 2022 · 11 comments

Comments

@Valorguy44
Copy link

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
Copy link
Owner

DaveGut commented Jul 7, 2022

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
Copy link
Author

Valorguy44 commented Jul 7, 2022 via email

@DaveGut
Copy link
Owner

DaveGut commented Jul 7, 2022

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
Copy link
Author

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
Copy link
Owner

DaveGut commented Jul 12, 2022

Some notes:

  • If the device IP is CLOUD (meaning the app was unable to find the device during the installation), it will change the comms to Cloud every time.
    • If this happens, you need to run install again using the Kasa Credentials (Cloud install) so that the device can reach the cloud.
  • If preference useKasaCloud is true and the preference bindStat is true and you have a Kasa Token (it is not null - but does not mean it is valid), the device will go to CLOUD.

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
Copy link

stangle commented Jul 22, 2022

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
Copy link
Owner

DaveGut commented Jul 22, 2022

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:

  • Are your devices on the same IP segment (i.e., all start with 192.168.1)?
  • What is your router (sometimes that configuration is messed up).
  • What is the Ping time using the tool within the Kasa Integration App > Kasa Integration Utilities > IP Comms Ping Test tool

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:

  • Run the Kasa Integration App and select problems with Install = true (blue).
  • Select Manually enter data and enter the device data onto the page.
  • Exercise the device (on/off) using the Kasa Phone App.
  • In the Kasa Integration App, select next. This will attempt to find the device up to three times with increasing timeout periods.
  • If this works, then the IP address will be correct for your device and you can convert to LAN on the device's edit page.
  • NOTE: If the device IP changes, you will have to repeat the above, so make sure the router has the static IP defined.

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
Copy link

stangle commented Jul 23, 2022

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
Copy link
Owner

DaveGut commented Jul 25, 2022

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:

  • App: rate-limit error on attempting to get error due to Kasa imposing rate limits.
  • Drivers: Fixed help link to new Link readme.

Update:

  • Update app and all drivers you use either via HPM on Manually.
  • After code update, run the App and the select DONE (no other actions required). This will:
    • initialize the new processing in the app
    • update the IPs for all LAN discoverable devices
    • run Save Preferences on all devices.

@stangle
Copy link

stangle commented Jul 29, 2022

This is working flawlessly. Thank you!

@DaveGut
Copy link
Owner

DaveGut commented Jul 29, 2022

Closing as a closed issue. Thanks.

@DaveGut DaveGut closed this as completed Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants