In the article NodeRed/Tasmota - Build a WhatsApp(*) icon lamp explains how to create your own WhatsApp(*) 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 use your self-built WhatsApp(*) lamp now.
(*)NOTEWhatsApp® and the WhatsApp logo are registered trademarks of WhatsApp, Inc. 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.
Import node code
You can use the following NodeCode to set up your WhatsApp(*)-Lampe steuern. Dazu müsst Ihr ggf. noch den Namen Eurer Lampe (falls dieser nicht „whatsAppLampe“ lautet) anpassen.
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.
Here is the actual NodeCode:
[{"id":"d2257647.527f38","type":"comment","z":"73482476.7e376c","name":"whatsAppLampe","info":"","x":180,"y":80,"wires":[]},{"id":"43faa0fa.f5215","type":"function","z":"73482476.7e376c","name":"","func":"if(msg.payload=="on") msg.payload=true; else msg.payload=false; return msg;","outputs":1,"noerr":0,"x":390,"y":160,"wires":[["cea5363d.3ac848"]]},{"id":"8da7a0d5.d8df1","type":"link in","z":"73482476.7e376c","name":"","links":["1c0fd2a8.9119ad"],"x":415,"y":120,"wires":[["cea5363d.3ac848"]]},{"id":"1d6f002c.17d81","type":"function","z":"73482476.7e376c","name":"","func":"msg.payload="#"+msg.payload; return msg;","outputs":1,"noerr":0,"x":410,"y":280,"wires":[["36b79394.d5f8dc"]]},{"id":"986fc0d1.bb7a7","type":"inject","z":"73482476.7e376c","name":"","topic":"","payload":"#ff9900","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":410,"y":320,"wires":[["36b79394.d5f8dc"]]},{"id":"36b79394.d5f8dc","type":"mqtt out","z":"73482476.7e376c","name":"","topic":"cmnd/whatsAppLampe/Color","qos":"","retain":"","broker":"c94e86db.dfcde8","x":640,"y":280,"wires":[]},{"id":"bd4379c0.b53908","type":"link in","z":"73482476.7e376c","name":"","links":[],"x":435,"y":360,"wires":[["36b79394.d5f8dc"]]},{"id":"95cfffe0.781bb","type":"ui_colour_picker","z":"73482476.7e376c","name":"","label":"whatsAppLampe","group":"9efc6f05.1b9a2","format":"hex","outformat":"string","showSwatch":true,"showPicker":true,"showValue":true,"showHue":false,"showAlpha":true,"showLightness":true,"dynOutput":"false","order":27,"width":0,"height":0,"passthru":true,"topic":"","x":210,"y":280,"wires":[["1d6f002c.17d81"]]},{"id":"897fb059.a7a5c","type":"ui_switch","z":"73482476.7e376c","name":"","label":"whatsAppLampe","group":"5303eeb6.d88a3","order":22,"width":0,"height":0,"passthru":false,"decouple":"true","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":650,"y":220,"wires":[["cea5363d.3ac848"]]},{"id":"cea5363d.3ac848","type":"Sonoff device","z":"73482476.7e376c","mode":"0","broker":"c94e86db.dfcde8","device":"whatsAppLampe","name":"","onValue":"ON","offValue":"OFF","cmdPrefix":"cmnd","statPrefix":"stat","telePrefix":"tele","x":630,"y":160,"wires":[["897fb059.a7a5c"]]},{"id":"7f0d7652.2d8a18","type":"alexa-local","z":"73482476.7e376c","devicename":"whatsAppLampe","inputtrigger":false,"x":210,"y":160,"wires":[["43faa0fa.f5215"]]},{"id":"33dc6f08.e3c04","type":"link in","z":"73482476.7e376c","name":"","links":["26a5b5ea.e3b65a"],"x":295,"y":200,"wires":[["7907aaef.b7a234"]]},{"id":"1ff908e8.669237","type":"link in","z":"73482476.7e376c","name":"","links":["d54aad83.530c2"],"x":295,"y":240,"wires":[["9353016f.ee0f8"]]},{"id":"7907aaef.b7a234","type":"change","z":"73482476.7e376c","name":"true","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":200,"wires":[["cea5363d.3ac848"]]},{"id":"9353016f.ee0f8","type":"change","z":"73482476.7e376c","name":"false","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":240,"wires":[["cea5363d.3ac848"]]},{"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":""},{"id":"9efc6f05.1b9a2","type":"ui_group","z":"","name":"Licht-Farbe","tab":"b29a978f.019318","disp":true,"width":"6","collapse":false},{"id":"5303eeb6.d88a3","type":"ui_group","z":"","name":"Licht","tab":"b29a978f.019318","disp":true,"width":"6","collapse":false},{"id":"b29a978f.019318","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
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. 🙂
Feedback: Too bad, I had expected more from the article. But one after anonther.
I was looking for a way to send messages to WhatsApp (e.g. when my washing machine is finished or the window is still open,...). So rather the other direction. Nevertheless, I read your article and also checked the code in the hope of finding clues on how to communicate with WhatsApp. Unfortunately none:
1) There's no explanation of how the code works
2) 2 nodes (sonoff and alexa) fail during import. So there are probably 2 library functions/addons that are required – including the links to them
Sonoff could be replaced. For example, I have the Tasmota AddOn. Which is probably from a different developer but has the same function!? So explanations of external library functions would be useful.
I don't have Alexa and I don't want it. An alternative proposal or description would also be useful. I assume that Alexa is linked to WhatsApp and passes on the information when a message arrives!?
Otherwise nice blog. And in German :-). The HW part is very well described and illustrated. Do you run the blog alone? Would certainly also be a nice community project to collect even more projects/examples.
Do you have an idea for sending WhatsApp messages – without Alexa ;-). I once found something where you could register your landline phone and then send messages from NodeRed as normal. But don't find that anymore. There is probably a US server that also mediates. But what data they then collect again….
Hi Konrad,
first of all sorry for the late reply and thanks for your tips and hints. 🙂
You're right. some information is missing here. It's been a while since I wrote this article and back then I didn't always pack all the information in such detail. But I will catch up when I revise this article. I plan to have this type of lamp supported by the pxlBlck plugin soon. Then I would write another article about it.
Regarding the WhatsApp problem:
Unfortunately, WhatsApp does not allow external clients and is also very strict when it comes to blocking all attempts in the direction. In order to still be able to be notified about new WhatAapp messages, I used Tasker (today I would use Automate) to create an automation on my cell phone. This ensured that a signal was sent to my MQTT server for every incoming Whatsapp message. This signal can then be further processed as desired.
Unfortunately, I've never done it the other way around. I've been using Pushbullet for years (to have messages sent to my cell phone). You can find information about this here, for example: https://nerdiy.de/howto-nodered-pushbullet-benachrichtigung-bei-ssh-login/
As for triggering phone calls:
If you have a FritzBox you can also use it to register external SIP clients. Such SIP clients can also be installed on a RaspberryPi. This could then be registered with the Fritzbox and make a call on command and play an mp3/wav, for example. But that's just theory. It's still on my "must try" list. 😀
To the blog:
Yes, I run it alone. Thank you for the praise. 🙂
Best regards
Fabian