Awesome, thanks. That worked (for a single device).
As written, the App won't work for multiple devices on a separate subnet because there doesn't appear to be a way to configure multiple discovery ports. Adding a configuration setting so that the user can specify either a range (9990-9999) or a list (9999, 8888, 7777) of ports to discover devices on would "fix" cross-subnet discovery.
I changed the port number in the App code and was able to discover a second device but port 9999 is also hard coded in the driver and used for control, so adding a port configuration field to the (Kasa Plug Switch) driver is the most pressing issue.
Finally, looks like your code isn't correctly handling the apostrophe character:
Final Update. I will have a test version on GitHub by midnite (TEXAS time) tonight. Will only include the APP and the single plug-switch driver for your testing. These can be installed as a NEW app and driver without impacting your current installation. Links for test files to follow.
I will look at implementing this. However, differently than you suggest:
APP:
Configuration option for portForwarding with user entered list of ports.
Each port will take 3 minutes to discover the devices.
Catch port for each device as part of database.
Use existing Auto Update for existing devices to add port to device data.
Driver
On initial update, check for new "port" data element.
If it does not exist, create as 9999.
Modify comms to use port data vice hard code.
Please Private Message Me if you wish to test this for the team. Dave
Update: Have you seen this thread? Interesting information on Subnets.
OK just updated to new app and driver
getting this error on two devices
KasaInt/6.4.3-r4] Failed to install device.
Device: 50C7BF17BA89={ip=192.168.1.39, plugNo=null, alias=Task light, model=HS100, type=Plug Switch, ledOff=false, dni=50C7BF17BA89, plugId=null} Driver: Plug Switch
what am I doing wrong (I always assume its user error )
[dev:27] 2021-12-12 08:03:33.126 pm [error](...)groovy.lang.GroovyRuntimeException:
Ambiguous method overloading for method java.lang.Integer#multiply. Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class java.lang.Character] [class java.lang.Number] on line 952 (method setColorTemperature)
Logs from line 951 show this (ignore the timestamp difference, I ran this again recently to get the log line):
Outdoor Light: on, level 100, color temperature 3500 (**3500** )
App Version: 6.4.3
Driver Version: 6.4.3
Oddly, when I look at App and Driver views, I have three App installs listed (6.4.0, 6.4.0 (yes, two), and 6.4.3) and two Driver versions (6.3.3 and 6.4.3). I install via Hubitat Package Manager. Maybe I need to do some clean up?
There is an issue with the startLevelChange() in the Dimming Switch device code. When it gets to the end (4%) it does not stop the level change and just toggles the device on and off until you click stopLevelChange. It also does not stop the level change when you set a new level with the scenario above. It is stuck in a loop.
For now, stop (disable) your device (on the Device Page, select X). This should stop the loop. Then restart the device. I have a major update to Dimming Switch in-work. Includes transition time for on/off and set level and the ability to configure the device (i.e., the Configuration in the Kasa App for the switch). It may be several days.