This server provides a simple little REST API that allows you to
- control Ikea Trådfri lights by connecting to a Trådfri gateway
- switch 433 MHz radio controlled power outlets on and off
If you want to control Ikea Trådfri lights, you'll need...
- at least one bulb (duh!)
- an Ikea Trådfri gateway, connected to the same network as the computer this software runs on
If you want to control 433 MHz power outlets, you'll need...
- a Raspberry Pi or similar device (something that has GPIO pins)
- a 433 MHz RF transmitter + receiver. e.g.:
- to connect both the transmitter and receiver to said Raspberry Pi, so some jumper wires could come in handy:
(Assuming you're using a Raspberry Pi with a freshly installed Raspbian. Under other circumstances, some steps might be slightly different or even obsolete.)
-
install git
sudo apt install git
-
install node.js v12.x
wget https://deb.nodesource.com/setup_12.x chmod +x setup_12.x sudo ./setup_12.x sudo apt install nodejs
For more info see: https://github.com/nodesource/distributions#debinstall
-
install WiringPi
git clone git://git.drogon.net/wiringPi cd wiringPi ./build cd ..
For more info see: https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
-
clone this repo with its submodules:
git clone --recursive [email protected]:chrisEff/home-server-nodejs.git
-
install the dependencies:
cd home-server-nodejs npm i --production
-
compile RPi_utils
cd 433Utils/RPi_utils make cd ../..
-
adjust
config.js
according to your needs -
allow node to bind ports < 1024 (dhcp-spy needs to listen on port 67 in order to detect DHCP requests from dash buttons):
npm run allow-portbind
-
enable reading DS18B20 temperature sensors via W1 bus:
sudo su echo 'dtoverlay=w1-gpio,gpiopin=4,pullup=on' >> /boot/config.txt echo 'w1-gpio pullup=1' >> /etc/modules echo 'w1-therm' >> /etc/modules reboot
For more info see (german): https://www.kompf.de/weather/pionewiremini.html
-
start the server
npm start
- home-assistant/core#10252
- https://learn.pimoroni.com/tutorial/sandyj/controlling-ikea-tradfri-lights-from-your-pi
- https://www.einplatinencomputer.com/raspberry-pi-433-mhz-funksteckdose-schalten/
- https://tutorials-raspberrypi.de/raspberry-pi-funksteckdosen-433-mhz-steuern/
coap-client -m post -u "Client_identity" -k "<KEY_FROM_GATEWAY>" -e '{"9090":""}' "coaps://<GATEWAY_IP>:5684/15011/9063"
coap-client -m get -u "" -k "" "coaps://<GATEWAY_IP>:5684/15011/15012"
coap-client -m get -u "" -k "" "coaps://<GATEWAY_IP>:5684/15001"
coap-client -m get -u "" -k "" "coaps://<GATEWAY_IP>:5684/15004"
coap-client -m get -u "" -k "" "coaps://<GATEWAY_IP>:5684/15001/<DEVICE_ID>"
coap-client -m get -u "" -k "" "coaps://<GATEWAY_IP>:5684/15004/<GROUP_ID>"
coap-client -m put -u "" -k "" -e '{ "3311" : [{ "5850" : 1 }] }' "coaps://<GATEWAY_IP>:5684/15001/<DEVICE_ID>"
coap-client -m put -u "" -k "" -e '{ "3311" : [{ "5850" : 0 }] }' "coaps://<GATEWAY_IP>:5684/15001/<DEVICE_ID>"
coap-client -m put -u "" -k "" -e '{ "3311" : [{ "5706" : "efd275" }] }' "coaps://<GATEWAY_IP>:5684/15001/<DEVICE_ID>"
coap-client -m put -u "" -k "" -e '{ "9001" : "foobar" }' "coaps://<GATEWAY_IP>:5684/15001/<DEVICE_ID>"