changes to config

revert-2-UseTasks
Andrew Woodlee 4 months ago
parent 201469afe9
commit 68471e0e47

@ -1,16 +1,30 @@
# Your WiFi SSID
XFORMER_MON_WIFI_SSID=Your-WiFi-SSID
# Your WiFi Password
XFORMER_MON_WIFI_PASSWD=Your-WiFi-Password
# Your MQTT server
XFORMER_MON_MQTT_SERVER=xformer.utilitymonitor.io
# Your MQTT User
XFORMER_MON_MQTT_USER=test
# Your MQTT Password
XFORMER_MON_MQTT_PASS=secure-mqtt-pass
# A unique ID
XFORMER_MON_MQTT_ID=unique-id
# The port the MQTT server is running on
XFORMER_MON_MQTT_PORT="8883"
# Must be "enabled" if using SSL!
XFORMER_MON_USE_SSL="enabled"
XFORMER_MON_USE_SSL="enabled"
# Only for the ATM90E36 board
# determines which line to read
# Determines which voltage needs to be set.
XFORMER_MON_LINE='A'
# To be set later:
XFORMER_MON_LINE='A'

@ -0,0 +1,28 @@
ssl:
# Must be true if using SSL!
enabled: true
wifi:
# Your WiFi SSID
ssid: "Your-WiFi-SSID"
# Your WiFi Password
passwd: Your-WiFi-Password
mqtt:
# Your MQTT server
server: xformer.utilitymonitor.io
# The port the MQTT server is running on
port: 8883
# Your MQTT User
user: test
# Your MQTT Password
password: secure-mqtt-pass
# A unique ID
id: unique-id
# Only for the ATM90E36 board
# determines which line to read
# Determines which voltage needs to be set.
XFORMER_MON_LINE='A'
# To be set later:
XFORMER_MON_LINE='A'

@ -2,8 +2,8 @@ Import("env")
# dictionary of environment variable names with the names as the values
# the keys may be the same as the values
# the keys must be defined in an .env file or the OS environment
# key (can be anything): value (must be in the .env file or OS environment)
# the values must be defined in an .env file or the OS environment
# key (can be anything) : value (must be in the .env file or OS environment)
envVars = {
"WIFI_SSID": "XFORMER_MON_WIFI_SSID",
"WIFI_PASSWD": "XFORMER_MON_WIFI_PASSWD",
@ -13,28 +13,29 @@ envVars = {
"MQTT_USER": "XFORMER_MON_MQTT_USER",
"MQTT_PASS": "XFORMER_MON_MQTT_PASS",
"MQTT_ID": "XFORMER_MON_MQTT_ID",
"TM_CT": "XFORMER_MON_CT_LINE", # if not set, will default to 'A' in code
"TM_CT": "XFORMER_MON_LINE", # if not set, will default to 'A' in code
}
import socket
import sys
try:
import dotenv
import yaml
import OpenSSL
from OpenSSL import crypto
except ImportError:
env.Execute("\"$PYTHONEXE\" -m pip install python-dotenv pyOpenSSL crypto")
from OpenSSL import crypto
env.Execute("\"$PYTHONEXE\" -m pip install python-dotenv pyOpenSSL crypto pyyaml")
import yaml
import OpenSSL
import dotenv
from OpenSSL import crypto
dotenv.load_dotenv()
with open('config.yml', 'r') as file:
monitorConfigFile = yaml.safe_load(file)
import os
import ssl
wifiConfig = monitorConfigFile["wifi"]
mqttServer = os.getenv(envVars["MQTT_SERVER"])
mqttUser = os.getenv(envVars["MQTT_USER"])
mqttPass = os.getenv(envVars["MQTT_PASS"])

@ -106,8 +106,8 @@ void loop()
mqttClient.publish("xfmormermon", "buffer");
// publish a message roughly every second.
// if (millis() - lastMillis > 1000)
// {
if (millis() - lastMillis > 1000)
{
lastMillis = millis();
monitorTempSensors.cabinet.requestTemperatures();
@ -138,7 +138,7 @@ void loop()
serializeJson(doc, mqttBuffer);
mqttClient.publish("xfomermon/", mqttBuffer);
// }
}
Serial.println("Sleeping 10s");
delay(10000);
}

Loading…
Cancel
Save