The TRADFRI plug is a simple way to switch existing consumers such as lamps via your smart home system via Zigbee
The consumer can be switched on and off. At the same time, the socket also functions as a signal amplifier (repeater) for all other Zigbee devices.
How you integrate the TRADFRI connector into your Node Red instance is described in the following article.
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:
Before you start this article, you should have prepared a Raspberry Pi so that it can be reached via the network and controlled via SSH. Of course, zigbee2mqtt and Node Red should also be installed and configured.
- RaspberryPi – setup for nerdiys!
- RaspberryPi – The first configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- NodeRed – Installing NodeRed on the RaspberryPi
- Zigbee - Installing zigbee2mqtt on the Raspberry Pi
- Zigbee - register devices, sensors and actuators with zigbee2mqtt
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screwdriver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Enable Zigbee2mqtt Dashboard
In my opinion, the easiest way to add new devices to your Zigbee network is to use the zigbee2mqtt dashboard. In case you haven't activated this yet, you will find helpful hints in the article Zigbee - Administration of Zigbee2mqtt via the dashboard.
Register sensor to zigbee2mqtt
Before you use the TRADFRI connector Node Red To use it, you must first integrate it into your Zigbee network.
I have a little more detail on how to integrate devices into your own Zigbee network in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described. The following two steps summarize this briefly.
To put the TRADFRI plug into pairing mode, you have to insert the battery and use a long object (e.g. a paper clip) to press the button in the small hole
- hold down for 10 seconds
The LED on the front of the socket should then flash and the socket should connect to your Zigbee network shortly afterwards.
You can track the status of the connection process in the zigbee2mqtt log.
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
The dashboard node should already be installed and configured so that you can also control your Zigbee device via the NodeRed dashboard or display the values. You can find information about this in the following article.
After that, all you have to do is import the NodeCode linked below into your NodeRed environment. Information on how to import NodeRed code can be found in the article Node Red - Import and export Node code .
As always, you can find the NodeRed code in the Nerdiy Git repository under the following link:
Of course, you still have to adapt the code to your socket. To ensure that it works correctly, you must enter the IEEE address or the "friendly name" in the Node Red code.
To do this, open the properties of the marked node and enter your IEEE address in the marked area under "Payload...". How to find out the IEEE address of your Zigbee device is in the article Zigbee – register devices or sensors and actuators with zigbee2mqtt described.
In order for the update function to work via the Node Red Dashboard, you must also enter the address here in the marked area.
In addition, the address must still be in this...
... and the area marked here can be entered.
If you would like to be notified automatically in the event that the socket has not been seen in the Zigbee network for a certain period of time, you can edit the corresponding message here.
You can of course also use the newly registered Zigbee device via the zigbee2mqtt Dashboard control or read out.
In the following category I have also listed other Zigbee devices which can be controlled or read out with the Node Red code offered there.
More articles on the topic
I have summarized other articles on the subject of Zigbee and zigbee2mqtt in the following category. There you will also find articles on various Zigbee devices and how they look like Node Red can be controlled.
External links:
- https://www.zigbee2mqtt.io/devices/E1603_E1702_E1708.html
- https://www.zigbee2mqtt.io/supported-devices/
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. 🙂