MQTT, INSTALL scripts work⤵

This commit is contained in:
Jokob-sk
2023-10-17 07:38:49 +11:00
parent 1b9d4223c5
commit 9dd456bd2c
5 changed files with 31 additions and 12 deletions

View File

@@ -22,7 +22,8 @@ services:
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/pihole_dhcp_full.leases:/etc/pihole/dhcp.leases
- ${APP_DATA_LOCATION}/pihole/etc-pihole/pihole-FTL.db:/etc/pihole/pihole-FTL.dba
- ${APP_DATA_LOCATION}/pialert/dhcp_samples/pihole_dhcp_2.leases:/etc/pihole/dhcp2.leases
- ${APP_DATA_LOCATION}/pihole/etc-pihole/pihole-FTL.db:/etc/pihole/pihole-FTL.db
- ${DEV_LOCATION}/pialert:/home/pi/pialert/pialert
- ${DEV_LOCATION}/dockerfiles:/home/pi/pialert/dockerfiles
- ${APP_DATA_LOCATION}/pialert/php.ini:/etc/php/8.2/fpm/php.ini

View File

@@ -102,11 +102,11 @@ date +%s > "$INSTALL_DIR/pialert/front/buildtimestamp.txt"
/etc/init.d/nginx start
# Start Nginx and your application to start at boot (if needed)
systemctl start nginx
systemctl enable nginx
# systemctl start nginx
# systemctl enable nginx
# systemctl enable pi-alert
sudo systemctl restart nginx
# # systemctl enable pi-alert
# sudo systemctl restart nginx
# Activate the virtual python environment
source myenv/bin/activate

View File

@@ -1,5 +1,9 @@
#!/bin/bash
echo "---------------------------------------------------------"
echo "[INSTALL] Run user-mapping.sh"
echo "---------------------------------------------------------"
if [ -z "${USER}" ]; then
echo "We need USER to be set!"; exit 100
fi
@@ -9,7 +13,7 @@ if [ -z "${HOST_USER_ID}" -a -z "${HOST_USER_GID}" ]; then
echo "Nothing to do here." ; exit 0
fi
# reset user_?id to either new id or if empty old (still one of above
# reset user_id to either new id or if empty old (still one of above
# might not be set)
USER_ID=${HOST_USER_ID:=$USER_ID}
USER_GID=${HOST_USER_GID:=$USER_GID}

View File

@@ -26,7 +26,14 @@
"string" : "A plugin to publish a notification via the Apprise gateway."
}
],
"params" : [],
"params" : [
{
"name" : "devices",
"type" : "sql",
"value" : "SELECT dev_LastIP from DEVICES",
"timeoutMultiplier" : true
}
],
"database_column_definitions":
[
{
@@ -271,7 +278,7 @@
{
"function": "CMD",
"type": "readonly",
"default_value":"python3 /home/pi/pialert/front/plugins/_publisher_mqtt/mqtt.py",
"default_value":"python3 /home/pi/pialert/front/plugins/_publisher_mqtt/mqtt.py devices={devices}",
"options": [],
"localized": ["name", "description"],
"name" : [{
@@ -294,7 +301,7 @@
{
"function": "RUN_TIMEOUT",
"type": "integer",
"default_value": 600,
"default_value": 10,
"options": [],
"localized": ["name", "description"],
"name" : [{

View File

@@ -100,9 +100,16 @@ class sensor_config:
plugObj = getPluginObject({"Plugin":"MQTT", "Watched_Value3":hash_value})
mylog('verbose', [f"[{pluginName}] Previous plugin object entry: {json.dumps(plugObj)}"])
# mylog('verbose', [f"[{pluginName}] Previous plugin object entry: {json.dumps(plugObj)}"])
if plugObj == {}:
self.isNew = True
mylog('verbose', [f"[{pluginName}] New sensor entry mac : {mac}"])
mylog('verbose', [f"[{pluginName}] New sensor entry input_string : {input_string}"])
mylog('verbose', [f"[{pluginName}] New sensor entry hash_value : {hash_value}"])
else:
self.isNew = False
self.isNew = plugObj == {}
# Log sensor
global plugin_objects
@@ -117,7 +124,7 @@ class sensor_config:
watched2 = sensorType,
watched3 = hash_value,
watched4 = mac,
extra = 'null',
extra = input_string,
foreignKey = deviceId
)