My system (RPiv4, 4GB mem, 16GB SD card) is stable at Core: 0.117.5, HassOS: 4.15, Supervisor: 202011.0
CPU Utilization < 2%
Full Snapshot and SDcard image saved for some future disaster recovery.
Obviously, now is the time to start tinkering with Node-Red. Installation from HACS complete.
I’ll move onto configuration when I get some free time
I thought the next step would be to install the TP-Link Contrib but I do not see the “npm” command. Is there an alternate install process?
Run the following command in the root directory of your Node-RED install
I’ve tried both http & https
I created a 2nd Long Lived Access token and re-entered the copy/save/paste into the NodeRed Server Node entry, still no joy.
Do Long Lived Access tokens update with “last used” info?
Your help has been invaluable. Please let me know if you can identify my error.
This now works as expected. The “trick” (also known as reading the documentation) was to ensure that the state variable was properly identified in switch node: “payload.state”
For some reason my inject is different than the original example. Posting mine in case someone else is the same as mine. It took a few minutes for me to figure it out!
How do you get the startPowerEvents to start up without clicking on the inject when you restart HA? Mine seems to stop working and then when I go click the inject it starts processing.
"Processing input for device 192.168.0.24: {"_msgid":"52e29724.319fa8","topic":"","payload":"startPowerEvents"}"
I see the same data on “Edit inject node”. It does work for me without any special action.
Perhaps you can try changing the “Inject once after” value from 0.1 to 1.0 seconds to allow the system to complete its initialization processes before sending the inject message.
(this is a pure guess on my part)
Ok everything is working now. I was being thrown off by using the get current state of the switch and then passing the on or off state through.
Then it was a matter of adding .state to the payload to read the right value. It’s been awhile since I have dabbled in past basic flows in NodeRed. Thank you for the illustration @YetAnotherDave
I had a related issue with my TP Link HS210 3 way switches. These switches seem to be the only decent 3 ways switches that will work with the wiring in my house since they will sense the current flow to the lights if the other 3 way switch is toggled (and I only have a neutral wire at one of the switches).
There is a slight delay when sensing the current to the light, so turning the light on from HA causes HA to show ON, then (I assume) read back and determine the light was OFF, then a little while later decide the light was actually ON. It could take 30 sec + for this indecision to stabilize.
The node red solution described above worked perfectly from both switches and HA. They show the state almost instantly and don’t flicker ON-OFF-ON like they used to. Thanks for the detailed posts.
Unfortunately, I experience the same delay. I have been using about 20x HS110 for more than one year and they all worked fine. However, a while ago they all started to show this delay behavior. Maybe the entire problem has something to do with a firmware update because the delay did definitely not appear, e.g., two months ago.
I have implemented the suggested fix in Node-RED and it seems to work fine. It is a nice workaround for a couple of plugs, but IMHO it is not a good solution if someone owns more plugs.
There’s no way that it’s reasonable for the integration to have a 30 second delay nor should we need to use node red hacks or home assistant update calls every 3 seconds to get the status of the switch. Other polling integrations don’t have this long of a delay (Hue for instance).
Looking at the docs I think the developer of this integration may have left the polling period set at the default (30 seconds) so I’m hoping this is an easy fix (change the period to a smaller value).
I’ve opened a bug if anyone wants to add addition feedback or anything I might have missed (I am new to this integration having just bought the switch on Black Friday):
Just for any one that views this I went the node red route mine for some reason was not quite as straight forward as above because I wanted separate on/off not just toggle. this is the flow I added to the mix.
Has anybody experienced issues with the Kasa node causing node-red to crash?
Whenever I deploy the node with my devices IP, I get a NGIX 502 Bad Gateway popup and then the add-on UI goes completely black. If I go into the config file and remove the Kasa node, everything goes back to normal working condition.
You can change the poll timing for the Kasa switches in
homeassistant/components/tplink/coordinator.py
change the line:
update_interval = timedelta(seconds=10)
to:
update_interval = timedelta(seconds=1)
It changes the polling interval to one second (similar to the node red interval above) and the delay for hass to notice the state change will be minimal. You can either modify the installation or copy the tplink component code into your custom_components directory to override.
I have more than a dozen Kasa smart switches/plugs and this works with no issues. I had been worried that this would flood my network or cause issues with Hass but this change seems to work with minimal (if any) impact.
My dude, many thanks for this, it worked like a charm!!
Also, many thanks to @YetAnotherDave for starting the thread.
Just one note regarding the folder access for whomever is trying this:
Log into the HA container’s CLI (e.g., using Portainer).
Where is the components folder on HA OS? It doesn’t seem to be in /usr/src/homeassistant… on my install, and it’s not in the same folder as custom_components or configuration.yaml
My dude – thanks for that!! I updated my HA, completely forgot about this issue, reminded myself, found my post, this thread, and now your awesome repo!