Community
OpenEnergyMonitor

Community

Controlling TP Link smart sockets via NodeRed

Tags: #<Tag:0x00007f6e0faf9f68> #<Tag:0x00007f6e0faf9e78> #<Tag:0x00007f6e0faf9d10>

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 https://github.com/node-red/raspbian-deb-package/blob/master/resources/update-nodejs-and-nodered

or this https://nodered.org/docs/getting-started/upgrading.html

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.