HowTo: Node Red – Control the Facebook(*)-Lamp

The article NodeRed/Tasmota – Building a Facebook(*) Icon Lamp explains how to build your own Facebook (*) lamp. The goal is to link these later with your SmartHome and, for example, to light up as soon as new notifications are available for you.

With the following NodeCode you can now test your self-made Facebook (*) lamp.

(*) NOTE: Facebook® and the Facebook logo are registered trademarks of Facebook, Inc. in the US and other countries.

Hints for our lovely english readers: Basically, many of the articles on are translations from the original german articles. Therefore, it may happen here and there that some illustrations are not available in english and that some translations are weird/strange/full of mistakes or generally totaly wrong. So if you find some obvious (or also not obvious) mistakes don't hesitate to leave us a hint about that in the comment section. 
Also please don't get confused, that instead of a "dot" often a "comma" is used as decimal separator. 🙂

Safety instructions

I know the following hints are always a bit annoying and seem unnecessary. But unfortunately, many people who knew it "better" from carelessness lost their eyes, fingers or other things or hurt themselves. In comparison, a loss of data is almost not worth mentioning, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Even the coolest project is worth no injury or other annoyance.

Affiliate links / advertising links

The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and shop via this link, receives a commission from the online shop or provider concerned. The price doesn't change for you. If you do your purchases via these links, you will support in being able to offer further useful projects in the future. 🙂


Helpful Articles:
Of course NodeRed should already be installed so that you can take over this configuration.
How to prepare a RaspberryPi and then NodeRed installed on it is described in the following articles.

The following articles describe what to do to prepare the RaspberryPi:
RaspberryPi – Setting up for Nerdiys!
RaspberryPi – The First Configuration!
RaspberryPi – Control the RaspberryPi via SSH
NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – install new nodes

Required tools:

Required material:

In the following list you will find all the parts you need to implement this article.

Log in to the NodeRed configuration interface

Before you can edit your NodeRed configuration you must - if activated - first log in to the NodeRed configuration interface.

View of the login screen. Here you have to enter the login details that you entered during the configuration of the login. Information about this can be found in the article NodeRed - User Login Setup.

Import Node Code

With the following NodeCode you can control your Facebook (*) – lamp. For this you may need to change the name of your lamp (if this is not “facebookLampe”).

To test this code you can easily import it into your NodeRed installation. Tips can be found in the article NodeRed – Import and Export Node Code.


Structure of the NodeCode.

Here is the actual NodeCode:

[{"id":"853f1e15.2c4cc","type":"mqtt out","z":"73482476.7e376c","name":"","topic":"cmnd/facebookLampe/backlog","qos":"","retain":"","broker":"c94e86db.dfcde8","x":1670,"y":180,"wires":[]},{"id":"57bdf52a.58774c","type":"function","z":"73482476.7e376c","name":"facebookLampe color Code","func":"\nvar blue=\"#0a0a7f\";\nvar white=\"#595860\";\nvar content=\"\";\n\n    for (var i = 1; i<21; i++) \n    {\n        content+=\"Led\"+i+\" \"+blue+\"; \";\n    }\n    \n    for (var i = 21; i<26; i++) \n    {\n        content+=\"Led\"+i+\" \"+white+\"; \";\n    }\nmsg.payload=content;\nreturn msg;","outputs":1,"noerr":0,"x":1380,"y":180,"wires":[["853f1e15.2c4cc","1d5d8f59.3db781"]]},{"id":"21d02887.be8b48","type":"inject","z":"73482476.7e376c","name":"","topic":"","payload":"start","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":930,"y":180,"wires":[["a7f38075.25959","7f1ecad4.4f0464","796e117.53d16f"]]},{"id":"1d5d8f59.3db781","type":"debug","z":"73482476.7e376c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1590,"y":100,"wires":[]},{"id":"2cfb7f55.82355","type":"delay","z":"73482476.7e376c","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1320,"y":220,"wires":[["ef5081c0.35bcb"]]},{"id":"ef5081c0.35bcb","type":"mqtt out","z":"73482476.7e376c","name":"","topic":"cmnd/facebookLampe/power","qos":"","retain":"","broker":"c94e86db.dfcde8","x":1660,"y":220,"wires":[]},{"id":"7f1ecad4.4f0464","type":"change","z":"73482476.7e376c","name":"OFF","rules":[{"t":"set","p":"payload","pt":"msg","to":"OFF","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1130,"y":220,"wires":[["2cfb7f55.82355"]]},{"id":"796e117.53d16f","type":"change","z":"73482476.7e376c","name":"ON","rules":[{"t":"set","p":"payload","pt":"msg","to":"ON","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":1310,"y":140,"wires":[["b2549fa9.2b81c"]]},{"id":"b2549fa9.2b81c","type":"mqtt out","z":"73482476.7e376c","name":"","topic":"cmnd/facebookLampe/power","qos":"","retain":"","broker":"c94e86db.dfcde8","x":1660,"y":140,"wires":[]},{"id":"a7f38075.25959","type":"delay","z":"73482476.7e376c","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1120,"y":180,"wires":[["57bdf52a.58774c"]]},{"id":"effb2209.225ef","type":"comment","z":"73482476.7e376c","name":"facebookLampe EinschaltAnimation","info":"","x":1020,"y":60,"wires":[]},{"id":"c94e86db.dfcde8","type":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

I hope everything worked as described. If not or you have any other questions or suggestions, please let me know in the comments. Also, ideas for new projects are always welcome. 🙂


P.S. Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you appreciate it that I share these information with you, I would be happy about a small donation to the coffee box. 🙂

Buy Me a Coffee at

Leave a Reply

Your email address will not be published. Required fields are marked *