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
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
pi@raspberrypi:~ $ sudo nano TradfriGatewayAutoreboot.py
line: 129, 130
securityid = "Asd1Asd2Asd3Asd4" # Security Code - from Gateway (16 characters)
ip = "111.111.1.111" # your device local ip
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" -----
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
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"
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