Crates.io | funksteckdosen-rest-rs |
lib.rs | funksteckdosen-rest-rs |
version | 0.1.0 |
source | src |
created_at | 2022-09-24 22:49:00.41614 |
updated_at | 2022-09-24 22:49:00.41614 |
description | A little rest server to use radio-controlled sockets with wiringPi. |
homepage | https://github.com/akuechl/funksteckdosen-rest-rs |
repository | https://github.com/akuechl/funksteckdosen-rest-rs |
max_upload_size | |
id | 673303 |
size | 49,821 |
A little rest server to use radio-controlled sockets with wiringPi in a Raspberry PI.
This program provides a HTTP server to call radio-controlled sockets. This program use the funksteckdose crate which use the wiringpi crate. You have to install wiringPi library on your system.
Please check here. Maybe wiringPi is pre-installed.
At the moment a used library needs the nightly rust compiler.
rustup override set nightly
Starts the server on port 12345 bind to IP 127.0.0.1 (default):
./funksteckdosen-rest-rs --port 12345
Starts the server on port 12345 without any IP binding:
./funksteckdosen-rest-rs --port 12345 --bind 0.0.0.0
http://localhost:12345/pin/11100/3/0
11100 is the system code
3 is the unit code
0 is the command (off)
change path in funksteckdosen_rest_rs.service
cp file to systemd
cp funksteckdosen_rest_rs.service /lib/systemd/system/
# start
sudo systemctl start funksteckdosen-rest-rs.service
# stop
sudo systemctl stop funksteckdosen-rest-rs.service
# show status
sudo systemctl status funksteckdosen-rest-rs.service
sudo systemctl enable funksteckdosen-rest-rs.service
sudo systemctl disable funksteckdosen-rest-rs.service
I control the sockets with my Home Assistant instance. For this I use the rest comand.
rest_command:
socket_2:
url: http://192.168.178.123:12345/pin/11100/2/0
socket_3:
url: http://192.168.178.123:12345/pin/11100/3/0