Skip to content

I want to restart IKEA Tradfri Gateway every day morning with Raspberry Zero W, the script with aiocoap creates a command for this idea.

Notifications You must be signed in to change notification settings

AndreiFAD/Tradfri-Ikea-Gateway-auto-reboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 

Repository files navigation

Tradfri Ikea Gateway auto reboot

I want to restart IKEA Tradfri Gateway every day morning with Raspberry Zero W,
the script with aiocoap creates a command for this idea.

source of my idea: https://github.com/ggravlingen/pytradfri


requirements (aiocoap requires Python '>=3.4.4'):

for all requirements install, use this:
pi@raspberrypi:~ $ pip3 install pytradfri[async] typing==3.6.6
or details:
pi@raspberrypi:~ $ pip3 install aiocoap==0.4a1 DTLSSocket==0.1.7 typing==3.6.6

Set your securityid and ip:

pi@raspberrypi:~ $ sudo nano TradfriGatewayAutoreboot.py
line: 129, 130

TODO: Change securityid and ip:

securityid = "Asd1Asd2Asd3Asd4" # Security Code - from Gateway (16 characters)
ip = "111.111.1.111" # your device local ip

With this command, it runs without aiocoap-tinydtls error/warrning messages:

python3 TradfriGatewayAutoreboot.py 2> /dev/null

pi@raspberrypi:~ $ python3 TradfriGatewayAutoreboot.py 2> /dev/null
----- HERE IS YOUR COMMAND: coap-client -u XXX -k XXX -v 0 -m post "coaps://1.1.1.1:5684/15011/9030" -----


For using you need install COAP-CLIENT:

sudo apt-get install libtool git build-essential autoconf automake -y
sudo git clone --recursive https://github.com/obgm/libcoap.git
cd libcoap
sudo git checkout dtls
sudo git submodule update --init --recursive
sudo ./autogen.sh
sudo ./configure --disable-documentation --disable-shared
sudo make
sudo make install
cd


create .sh file:

pi@raspberrypi:~ $ sudo nano /usr/local/bin/rebootTradfri.sh
add line:
coap-client -u XXXXXXXXXXXX -k XXXXXXXXX -v 0 -m post "coaps://XXXXXXXXXXX:5684/15011/9030"

Add Execute permission:

pi@raspberrypi:~ $ sudo chmod +x /usr/local/bin/rebootTradfri.sh

pi@raspberrypi:~ $ sudo crontab -e
and add new line for every day reboot at 5 o'clock:
0 5 * * * /usr/bin/sudo -H /usr/local/bin/rebootTradfri.sh >> /dev/null 2>&1

pi@raspberrypi:~ $ sudo reboot

The quick and simple editor for cron schedule expressions by Cronitor:

https://crontab.guru/every-day

About

I want to restart IKEA Tradfri Gateway every day morning with Raspberry Zero W, the script with aiocoap creates a command for this idea.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages