[RELEASE] TP-Link Plug, Switch, and Bulb integration


#41

Excellent job! Though the naming change of the app totally freaked me out as I am looking for TP-Link not Hubitat TP-Link lol!


#42

Hi Dave (@djgutheinz)

Thanks for your fine work!!

I previously had a functional Node config running on a Pi with 2 TP-Link HS105 devices using TP-LinkHub_v2.js

  • Updated the *_v2.js file to *_v3.js
  • Updated TP-Link Plug-Switch (Hubitat).groovy
  • Added TP-Link Hubitat Manager.groovy

Initially got this error in the Hubitat TP-Link/Kasa Manager log
image

Restarted the PI & then got this; ALL OK!!!

image

As both devices were already there & functional, I deleted 1 device.

I also updated the following in the remaining plug:

image

In theory the Hubitat TP-Link/Kasa Manager should now discover the plug I deleted from the system earlier... However, it just sits at this screen & never discovers anything:

image

I am also now getting this error:

image

I am sure this error is because the node server crashed and that a restart will fix it, but I am also sure the crash will happen again...

Edit:

Restarted the Pi, was OK for a short while & back to the error state:

image

Thanks
J


#43

Had to update all my devices with installation type but all is working and migrated. Now to look at you local json implementation as I do have a dedicated Pi3 for the home.


#44

Are the devices working? Indications from the last message is the node.js applet was not running at the time. For PCs, I use a bat file that restarts the node when it stops for an error; however, there may be an untrapped error that is causing the crash on the pi3.

Dave


#45

Yup I am good


#46

I have been using the local node server since @djgutheinz released it for hubitat It has been rock solid for me.


#47

HS107 and HS300 now supported

Added support to HS107 and HS300. One issue. For Hub (Node Applet) installation, the user must manually update the label after installation. A temporary label is created on initial installation. (I am working on this shortfall.)


#48

Just updated the Node Applet to eliminate an error while polling for devices. It was crashing on a socket close. Added a "try" routine to preclude crash. Applet available on the new GitHub link.

Dave


#49

@djgutheinz I am not good. The cloud doesn’t seem to work correctly and I had to revert to the deprecated cloud drivers. This was only for my colored bulbs. All switches worked without issues.

Issues by just changing code:

  • lost all color control
  • lost circadian
  • lost level control

Devices would show ok and no error in logs. Just won’t work like expected. I did not try to delete the devices and re-add them (yet!). But if I go that route I am moving to local execution with your JSon script.

Any thoughts or suggestions?


#50

Thanks for the heads-up. I checked this AM. Color has to be fixed since GitHub added a Color Selector in the device vice manual hue - saturation entry. Good feature. Just need to fix.

All the other are confirmed to work OK. (Hub or cloud should not make a difference.) Will fix driver and post back when done (hours or less, not days).


#51

Just did a full check using the Devices from the Devices Tab against my LB-130 with both Hub and Cloud installation. All worked OK. Note that the design sends the same command to the bulb either via the node applet or Kasa cloud.

I did update the color Driver on GitHub to set the default hue to low resolution. You might want to try that one instead - just in case something is weird.

Some items:

Color. When Hubitat implemented the Color selector, they use the LowRezHue mode. Go to preferences and set lowRezHue.

Color. The default display from GitHub showed an invalid hue/saturation. I had to select a color to update to valid(?????).

SetCircadian - it only sets circadian mode. To leave circadian, do any other function (off-on, level, colorTemp).

Color Temp. Range is 2500 to 9000 for the LB130.

What model bulb do you have. Would be nice to see logs - even if they do not show errors. The logs show the state returned from the bulb.

Dave


#52

Very interesting results. After setting the LowRezHue to lowRezHue the color comes out correctly but now I see another bug with "color name." You will see below that the hue selector I used is green but the color name is orange?? Also the Set Level does nothing.


#53

will fix color name when I get back. Assume you have an LB230.

Set level:
100 percetn

50 percent


#54

I am using both LB230 and LB130.


#55

Believe color naming is fixed in the test code sub-directory on GitHub:

TP-Link Color Bulb (TEST).groovy

This also logs some data for Level so I can figure out what is going on. Need you to use live logging and try to set level. Then provide logs in reply message (and if it works). Will allow me to find out what is going on.


#56

Alright...I installed the (Test) version. Color naming still is not working correctly and cannot change level. I am not exactly sure why either. When I set it to blue the color name is yellow. But if I set it to hot pink or red it shows up as Chartreuse.


#57

I see the errors. Trying again.

  1. Transition time. You installed by replacing the file content. I did not account for that, so the default transition time is not being set (is null - therefore null pointer. (Do not fix yet. I will provide instructions.)

  2. Color. I will change the map for lowRezHue. This will realign the color names.

Other things.

a. In the color implementation (devices tab), the Hubitat interface is also generating a level. I will update my code to receive level in this command.

b. Hubitat is now providing ranges for entries in the Device page. For Transition time, they have chosen seconds for scale. I am currently using milliseconds (native to the bulb). I will change this and also try to account for current defaults.

Will take an hour or so to fix and provide update.

Dave


#58

Updated test code. Instructions

After replacing, go to the devices page and select save preferences (do not have to set any).

Turn on logging again and test the code. Please reply here in any case.

(If you have a problem with setting the level, try setting the Transition Time preference. If this fixes, again, please tell me. I tested on my bulb; however, I already had a transition time set, so I can not replicate the null condition.)

Fixes:

  1. Save Preferences will look for a null transTime. If null, will set default to zero.
  2. Updated the transition time input from milliseconds to seconds (to match Hubitat device page scale).
  3. Added Level to color map settings (again to match Hubitat device page color entry).
  4. Fixed lowRezHue hue calculation to correct color naming problem.

dave


#59

@djgutheinz

Ok so we are making progress? Maybe?

What works:

  • Turn off the bulb
  • Set Color Temp
  • Set Color (after you get the bulb to light up)
  • Color Name is correct
  • Set Circadian

What doesn't work:

  • Can't turn on bulb
  • Can't set level

Logs:

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:59.199 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 10% / Circadian Mode: normal / Color Temp: 0K / Color: [hue:65, saturation:100]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:59.197 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Blue

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:59.193 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is RGB

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.411 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 50% / Circadian Mode: normal / Color Temp: 0K / Color: [hue:65, saturation:100]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.410 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Blue

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.409 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is RGB

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.364 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 50% / Circadian Mode: normal / Color Temp: 0K / Color: [hue:65, saturation:100]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.357 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Blue

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:52.344 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is RGB

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:42.350 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 100% / Circadian Mode: normal / Color Temp: 0K / Color: [hue:65, saturation:100]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:42.349 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Blue

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:42.337 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is RGB

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:35.841 am [error](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Entered hue or saturation out of range!

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.803 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 12% / Circadian Mode: normal / Color Temp: 0K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.797 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Red

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.793 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is RGB

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.297 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: off / Brightness: 12% / Circadian Mode: normal / Color Temp: 3000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.293 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Soft White

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.291 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.262 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: off / Brightness: 12% / Circadian Mode: normal / Color Temp: 3000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.254 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Soft White

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:30.252 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.680 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: off / Brightness: 12% / Circadian Mode: normal / Color Temp: 3000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.678 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Soft White

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.672 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.654 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: off / Brightness: 12% / Circadian Mode: normal / Color Temp: 3000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.652 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Soft White

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:29.650 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:09.082 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 12% / Circadian Mode: normal / Color Temp: 4000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:09.079 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Moonlight

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:09.075 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:04.186 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 12% / Circadian Mode: normal / Color Temp: 4000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:04.185 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Moonlight

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:04.183 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:03.610 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: on / Brightness: 12% / Circadian Mode: normal / Color Temp: 4000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:03.604 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Moonlight

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:51:03.585 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:40.120 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Power: off / Brightness: 12% / Circadian Mode: normal / Color Temp: 4000K / Color: [hue:0, saturation:0]

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:40.116 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left color is Moonlight

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:40.113 am [info](http://10.0.2.38/device/edit/272)Fireplace - Left Color Mode is CT

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:37.658 am [info](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left Hue Scale set to lowRez

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:37.652 am [info](http://10.0.2.38/device/edit/272)Light Transition Time for LB230(E26) Fireplace - Left set to 1500 seconds

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:37.650 am [info](http://10.0.2.38/device/edit/272)Light Transition Time for LB230(E26) Fireplace - Left set to 0 seconds

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:37.565 am [info](http://10.0.2.38/device/edit/272)Updating Fireplace - Left...

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:11.635 am [error](http://10.0.2.38/device/edit/272)java.lang.NullPointerException: Cannot invoke method toInteger() on null object on line 119 (on)

[dev:272](http://10.0.2.38/logs#dev272)2018-11-29 08:50:08.093 am [error](http://10.0.2.38/device/edit/272)LB230(E26) Fireplace - Left: Entered hue or saturation out of range!

#60

in preferences, try setting the transition time to 1 second. (I noted in your sequence a transition time of 1500 seconds. That would preclude level and on off (take 25 minutes to complete). I will add to code to look for legacy transition times and convert to nearest second.