HowTo: Node Red – Control Facebook(*) lamp

In the article NodeRed/Tasmota – Build a Facebook(*) icon lamp explains how to get your own Facebook(*) lamp. The aim is to link this later with your SmartHome and, for example, have it light up as soon as new notifications are available for you.

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

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


Safety instructions

I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/

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 make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂 


Requirements

Helpful articles:
To be able to use this configuration, NodeRed should of course already be installed.
How to prepare a RaspberryPi and then install NodeRed on it is described in the following articles.

The following articles describe what has to be done to prepare the RaspberryPi so far:
RaspberryPi – setup for nerdiys!
RaspberryPi – The first configuration!
RaspberryPi – Control the RaspberryPi via SSH

NodeRed – Installing NodeRed on the RaspberryPi
NodeRed – Install new nodes

Required tool:
-no-

Required material:

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


Log into the NodeRed configuration interface

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

View of the login dialog. Here you have to enter the login data that you specified during the configuration of the login. You can find information about this in the article NodeRed - set up user login.

Import node code

With the following NodeCode you can use your Facebook(*) lamp control. To do this, you may have to adjust the name of your lamp (if it is not “facebookLampe”).

To test this code, you can simply import it into your NodeRed installation. You can find tips on how to do this 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":" var blue="#0a0a7f"; var white="#595860"; var content=""; for (var i = 1; i<21; i++) { content+="Led"+i+" "+blue+"; "; } for (var i = 21; i<26; i++) { content+="Led"+i+" "+white+"; "; } msg.payload=content; return 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":"facebookLamp switch-on animation","info":"","x":1020,"y":60,"wires":[]},{"id":"c94e86db.dfcde8","type ":"mqtt-broker","z":"","name":"Server-Mqtt","broker":"server.fritz.box","port":"1883","clientid":" ","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"", "closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

Have fun with the project

I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂

PS 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 think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂

Buy Me a Coffee at ko-fi.com       

Kommentar hinterlassen

Your email address will not be published. Erforderliche Felder sind mit * markiert

This site uses Akismet to reduce spam. Learn how your comment data is processed.