Controlling TP Link smart sockets via NodeRed

Struggling newb here guys - be gentle.
I have recently purchased an EmonPi and have happily been logging data for a month or so.
After a while - I decided I needed to actually use the data as a basis for controlling stuff.
Enter NodeRed. I’m running on v15.3
I have several TP-Link hs100 smart plugs, and so wanted to use these.

I found what should be the ideal node - node-red-contrib-hs100.
I have attempted to install it - first using the palette manager. and although it showed up in the palette at the first attempt - it would not work, when used in a flow.

I then uninstalled it using the palette manager and attempted to install it again manually - using putty to ssh into the pi.
Appeared to work. restarted NodeRed - but no Node in Palette.
The node appears in the list of nodes installed in the palette manager - but if I click on the >1 node button - the node is greyed out.

Has anyone had any success with this hs100 node.
I successfully installed the node-red dashboard stuff - it showed up and worked fine -

Any ideas?
All suggestions gratefully received.
But could you please assume I am a 60 year old idiot with little to no coding / Raspberry Pi experience - coz I am :slight_smile:

Thanks

George

node-red v15.3 (I assume you mean v0.15.3) is now over a year old, as the current version is v0.18.3 and has advanced tremendously over that period.

You may find that many of the contrib nodes rely upon specific dependency file versions, which may not be available in v0.15.3. So I would advise that in the first instance that you update node-red and try again.
The node-red update guide details how to upgrade, although I’m not familiar with the emonpi’s structure (as emonpi is based upon a cut-down version of raspbian & the OS is read-only). Perhaps @pb66 or @borpin may be able to clarify pls.

It would also be worth looking at the node-red log;
$ node-red-log

Paul

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