initial release

This commit is contained in:
Siwat Sirichai 2022-11-17 13:37:50 +07:00
parent 484a6bfae0
commit 2e451d99a7
6 changed files with 57 additions and 4 deletions

14
config.json Normal file
View File

@ -0,0 +1,14 @@
{
"MQTT_SERVER": "",
"MQTT_USE_AUTH": false,
"MQTT_USERNAME": "",
"MQTT_PASSWORD": "",
"MQTT_BASE_TOPIC": "/ledstrip/fixture1",
"FRAME_TIME": 0.05,
"SERIAL_PORTS_MAP": [
"COM1"
],
"LED_MAP": [
60
]
}

18
config_generator.py Normal file
View File

@ -0,0 +1,18 @@
import json
from getpass import getpass
print("Siwat Light Control Protocol Configuration Generator")
server = input("MQTT Server Hostname / IP Address : ")
username = ""
password = ""
while True:
use_auth = input("Does this server require username and password to login (yes/no) : ")
if use_auth.lower() == "yes":
username = input("Username : ")
password = getpass("Password : ")
break
elif use_auth.lower() == "no":
break
print("Please answer yes / no")
base_topic = input("MQTT Base Topic : ")
frame_time = input("Frame Time (1/refresh rate) : ")

View File

@ -1,8 +1,16 @@
echo "Installing Dependencies" echo "Installing Dependencies"
sudo apt update sudo apt update
sudo apt install python3 python3-pip sudo apt install -y python3 python3-pip
sudo pip3 install siwat-light-control-protocol sudo pip3 install siwat-light-control-protocol
sudo mkdir /slcp
echo "Moving Directory to SLCP"
sudo mv -v ./ /slcp
sudo chmod 777 -Rv /slcp sudo chmod 777 -Rv /slcp
cp -v ./slcp_config.json /slcp/config.json
echo "Adding Service to systemd" echo "Creating systemd Service"
sudo chmod +x /slcp/jumpstart.sh
sudo ln -v /slcp/slcp.service /lib/systemd/system/slcp.service
sudo systemctl daemon-reload
sudo systemctl enable slcp.service
echo "Installation Completed!"
echo "Adjust /slcp/config.json then run sudo \"systemctl start slcp.service\""

2
jumpstart.sh Normal file
View File

@ -0,0 +1,2 @@
cd /slcp
python -m siwat_remote_light_control_protocol_server

View File

@ -0,0 +1,11 @@
[Unit]
Description=Siwat Light Control Protocol Server
After=multi-user.target
[Service]
Type=simple
WorkingDirectory=/slcp
ExecStart=/slcp/jumpstart.sh
[Install]
WantedBy=multi-user.target

View File