Controlling TP Link smart sockets via NodeRed

Hi Paul,
Yes - I did indeed mean v0.15.3.
I’ll have a look at the node red update guide and might attempt that if I get up the courage!
Stopping node-red and restarting it just now i noted the warning
[hs100] Syntax error. Use of const in strict mode.

hs100 is the node I am having the issue with.
it was published 3 months ago - and probably needs newer versions of node red.

Thanks again - I’ll keep reading - it is a steep learning curve - but I’m a persistent old blighter - I’ll keep at it!

George

Sorry no, I don’t run any emonpis. There is a script I think somewhere for upgrading Node-red. I seem to remember that the relationship between nodejs and node-red can cause issues.

thy this raspbian-deb-package/resources/update-nodejs-and-nodered at master · node-red/raspbian-deb-package · GitHub

or this Redirecting…

I’ve not tried updating in a while.

Ah, sorry Brian, I thought that you had an emonpi as well as the dietPi.
On a normal Raspbian Stretch install, updating is as simple as running;
update-nodejs-and-nodered
…and the inbuilt script looks after everything.

I updated my raspberry pi only a few days ago, and it updated flawessly, but emonpi is probably a different ball game, because of it’s bespoke structure and cut down OS.
That’s why I’m trying to support George here, rather than just signpost him to the node-red forum.

Paul

A post was merged into an existing topic: Updating node-red in emonpi

See Updating node-red in emonpi

Paul

Sorry. no, I use don’t use nodered or the emonSD/emonPi image I’m at a loss on that front.

However I do have some of the TP-Link HS110 smartplugs same device but with in-built monitoring that I have a draft Python script for that posts to an emonhub socket that I intend to develop into an emohub interfacer, so at somepoint in the not so distant future we may see this functionality available in emonhub, although it would also have been nice to see this Wifi Meter plugs out of the box (Z-WAVE or others) discussion result in a emoncms module.

No worries, I think Jon has already got this sorted in the linked thread.

Paul

Ok guys,

Problem is now resolved.
Eventually decided to update node red, as problem seemed to be the node I wanted to use needed a newer version of node.js.
As i was running 0.15.3 update-nodejs-and-nodered worked (at the second attempt - as I forgot to do the rpi-rw thing first time round - the emonpi filesystem is ro by default.

I only needed to install a few nodes relating to the emoncms and weather underground to get back to the node-red setup I had before.
Installed the problem node-red-contrib-hs100 node - Success - and I am now happily switching on and off smart plugs all over the house.
Mutch to the wife’s disgust!

Thanks for the support guys - as I said - it is a steep learning curve -but I git there in the end, and I’m looking forward to exploring the possibilities of Emonpi and Node red to add to my existing setup based on Amazon Echos, hue lights and the hs100 smart switches.

Retirement is a blast!

Thanks again

George

Ha ha, tell me about it!

Paul

That may be why the initial install did not work.

Hi Brian,

Nah,
Remembered to switch to rw before initial attempt, and had installed a couple of other nodes that did work.

If I try to install nodes with filesystem set to ro it simply fails to install - and says so - I tested that out too.

Looks like file dependencies was probably the problem on that specific node.
(lookit me - sounding like I know what I am talking about!)

Working now - so all good.
Just discovering all the hue light nodes out there.
I’m going to have a load of fun with this stuff!

GB

1 Like

Are you able to provide some examples of the Node Red code you used to control these TP Link devices, particularly the HS100 smart switches.

Hi, I’m trying to use the node-red-contrib-tplink node to control a tp-link Tipo p100 smart plug. From my mobile app, that’s fine and I can see the plug’s IP, but when I try to scan the plug with tplink node, I cannot identify it, and if I enter the address manually, I get this error: “Error connecting to device 192.168.1.85: Error: connect ECONNREFUSED 192.168.1.85:9999”. Any help appreciated! Thanks in advance

I saw this error for the first time recently. I also noticed that the plug was flashing orange, meaning it was not connecting correctly to wifi.
I reinstalled the offending smart plug in the Kasa app. All was fine after that.
GB

Thank you George! You mean with the android app right? I’ve been deleting the plug and re-installing it a couple of time, it is seen by the app and works fine with it, but no luck from node-red. The IP seems to be static, I’ll try to use another plug and keep the little button beside it pushed. Maybe something will happen (I’m in the realm of banging the TV to switch it on really)

Yes I meant re install the smart switch on the android app.
But, my error showed up on a switch that had already been working fine in a node red flow.
If starting from scratch:

I usually install a plug on the android app and get it working there . Then go to my router configuration page and identify that plug in the attached devices list. I then assign that device a static IP address. After that I go into node red and drag over an hs100 node and open it up. I assign the plug the fixed address I gave it in the “TP link switch IP address” field.
I currently have 10 switches all talking nicely to node red.
I’m not sure where the problem is, but it is possibly no coincidence that you saw an error I have only just seen for the first time, after using these switches constantly for around four years.
Possibly a manufacturer software update?
Whatever, my rogue one is back in the fold again, so it should be resolvable.

GB

Hi George, I changed the static IP as suggested, without result. I then noticed, however, that a new error is now thrown out: “Sorry. Your selected device is invalid!”. Having just bought these new tp-link TAPO P100 plugs, I see they are managed by another software from tp-link, appropriately named “TAPO” and not “Kasa”. My educate and ignorant guess at this point is that there are three solutions for me:
a) [which I don’t want to go for]: but an Alexa Echo Dot, use that to see the TAPO p100 plus, and communicate with node-red;
b) buy an older but tested hs100 plug (which is, BTW, way more expensive than the new TAPO p100 devices, like three times more expensive);
c) wait for someone to update the TP-Link node or come up with a TAPO-specific node.

I’m wondering though, if I’m the only one with this issue, or there are folks out there that successfully connected specifically the TAPO p100 plugs with no fuss

Hiya,
I have not come across the Tapo plugs before. I presume they are relatively new on the market. I only have experience of the original Kasa / h s100 and hs110 plugs. Sorry.
The node red node is unlikely to be updated as it has not changed much in the 4 years or so I have been using these plugs.

If you are thinking of attempting to communicate directly with Alexa via Node-Red in some way, and then using Alexa to trigger the plug that also is not easy and is probably not possible.
Amazon don’t like people being able to do too much with their baby!
Most Node-Red interactions with Alexa are clunky work-arounds.

I would suggest the way to go would be the purchase of the genuine h100 or h110 plugs. As I know they work fine. But yes, it is expensive. Probably not what you want to hear. Sorry!

GB

If you only want to use voice control to switch plugs then an echo dot should work directly with your tapo plugs.

You would not need node red in that scenario.

But, with the old hs100 110 plugs and node-red obviously you can do a lot more.

GB

@BrochGB1you read my mind about node-red → echo-dot → Tapos :slight_smile:
Indeed I wanted to do just that, because I’d like to use my Arduino and ESP microcontrollers for all 5v/12v / sensors / actuators / pwm controls of a large orchid enclosure I’ve been designing for the last two years, and smart plugs for the 220v (I sort of do not like to have too many high tensions DIY connections around water and kid). OK I’ll go with the h100/h110 folks. If they do not work I may have to resort to simple relays / triacs controlled by ESP. Not my first choice. Also, I do not like Amazon to enter the scenario, I wanted something nuclear plant - proof that I will not update for the next seven years and then an AI will design it for me in a snap :smiley:
Thank you :hugs: