Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data/config/mosquitto/mosquitto.acl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# openwb-version:2
# openwb-version:3
# allow publishing set topics
topic write openWB/set/#
# allow clearing system messages
Expand All @@ -11,3 +11,5 @@ topic read openWB/#
topic read openWB-remote/#
# allow brach "others" for devices other than openWB
topic readwrite others/#
# allow read write access for simpleAPI
topic readwrite openWB/simpleAPI/#
15 changes: 15 additions & 0 deletions data/config/openwb-simpleAPI.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# openwb-version:1
[Unit]
Description="openWB mqtt simpleAPI"
After=mosquitto.service

[Service]
User=openwb
WorkingDirectory=/var/www/html/openWB
ExecStart=/var/www/html/openWB/simpleAPI/simpleAPI_mqtt.py
Restart=always
# extend timeout to 15min for long running atreboot
TimeoutStartSec=900

[Install]
WantedBy=multi-user.target
11 changes: 11 additions & 0 deletions data/config/simpleAPI_mqtt_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"host": "localhost",
"port": 1883,
"username": null,
"password": null,
"use_tls": false,
"qos": 0,
"retain": true,
"reconnect_delay": 10,
"log_level": "INFO"
}
5 changes: 5 additions & 0 deletions openwb-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ ln -s "${OPENWBBASEDIR}/data/config/openwb2.service" /etc/systemd/system/openwb2
systemctl daemon-reload
systemctl enable openwb2

echo "installing openwb2-simpleAPI service..."
ln -s "${OPENWBBASEDIR}/data/config/openwb-simpleAPI.service" /etc/systemd/system/openwb-simpleAPI.service
systemctl daemon-reload
systemctl enable openwb-simpleAPI

echo "installing openwb2 remote support service..."
cp "${OPENWBBASEDIR}/data/config/openwbRemoteSupport.service" /etc/systemd/system/openwbRemoteSupport.service
systemctl daemon-reload
Expand Down
15 changes: 15 additions & 0 deletions runs/atreboot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ chmod 666 "$LOGFILE"
sudo reboot now &
fi

# check for openwb-simpleAPI service definition
if find /etc/systemd/system/ -maxdepth 1 -name openwb-simpleAPI.service -type l | grep -q "."; then
echo "openwb-simpleAPI.service definition is already a symlink"
else
if find /etc/systemd/system/ -maxdepth 1 -name openwb-simpleAPI.service -type f | grep -q "."; then
echo "openwb-simpleAPI.service definition is a regular file, deleting file"
sudo rm "/etc/systemd/system/openwb-simpleAPI.service"
fi
sudo ln -s "${OPENWBBASEDIR}/data/config/openwb-simpleAPI.service" /etc/systemd/system/openwb-simpleAPI.service
sudo systemctl daemon-reload
sudo systemctl enable openwb-simpleAPI
sudo systemctl restart openwb-simpleAPI
echo "openwb-simpleAPI.service definition updated."
fi

# check for remote support service definition
if [ ! -f "/etc/systemd/system/openwbRemoteSupport.service" ]; then
echo "openwbRemoteSupport service missing, installing service"
Expand Down
38 changes: 38 additions & 0 deletions simpleAPI/config/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

return [
// MQTT Broker Konfiguration
'mqtt' => [
'server' => 'localhost',
'port' => 1883,
'username' => '',
'password' => '',
'clientid' => 'SimpleAPI_' . uniqid()
],

// API Konfiguration
'api' => [
'cors_enabled' => true,
'max_request_size' => '10M'
],

// Authentifizierung
'auth' => [
'enabled' => false,
'require_https' => false,

// Gültige Tokens
'tokens' => [
// 'your-secret-token-here'
],

// Benutzer (Username => Passwort/Hash)
'users' => [
// 'admin' => password_hash('admin123', PASSWORD_DEFAULT),
// 'user' => 'plaintext_password'
]
],

// Debug-Modus
'debug' => false
];
Loading