Skip to content

Commit

Permalink
More development...
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieucarbou committed May 30, 2024
1 parent 653160d commit de94af1
Show file tree
Hide file tree
Showing 97 changed files with 3,687 additions and 5,429 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
cpplint \
--repository=. \
--recursive \
--filter=-whitespace/line_length,-whitespace/braces,-whitespace/comments,-runtime/indentation_namespace,-whitespace/indent,-readability/braces,-whitespace/newline,-readability/todo,-build/c++11 \
--filter=-whitespace/line_length,-whitespace/braces,-whitespace/comments,-runtime/indentation_namespace,-whitespace/indent,-readability/braces,-whitespace/newline,-readability/todo,-build/c++11,-runtime/references \
--exclude=lib/ElegantOTAPro \
--exclude=lib/ESPDASH \
--exclude=lib/ESPDASHPro \
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
/.vscode/*
!/.vscode/settings.json
/logs
/platformio_override.ini
/platformio_override.ini
/platformio-device-monitor*.log
/data/*.gz
163 changes: 67 additions & 96 deletions data/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,133 +61,104 @@ <h1>YaSolR Configuration</h1>

<script>
const supportedConfig = {
Management: "TITLE",
debug_enable: ["Debug mode enabled ?", "switch"],
Pinout: "TITLE",
pin_disp_scl: ["Display SCL (CLOCK)", "pin"],
pin_disp_sda: ["Display SDA (DATA)", "pin"],
pin_ds18: ["DS18 of router", "pin"],
pin_jsy_rx: ["Serial RX connected to JSY TX", "pin"],
pin_jsy_tx: ["Serial TX connected to JSY RX", "pin"],
pin_lights_g: ["LED Green", "pin"],
pin_lights_r: ["LED Red", "pin"],
pin_lights_y: ["LED Yellow", "pin"],
pin_o1_dim: ["Output 1 Dimmer", "pin"],
pin_o1_ds18: ["Output 1 DS18", "pin"],
pin_o1_relay: ["Output 1 Bypass Relay", "pin"],
pin_o2_dim: ["Dimmer", "pin"],
pin_o2_ds18: ["Output 2 DS18", "pin"],
pin_o2_relay: ["Output 2 Bypass Relay", "pin"],
pin_pzem_rx: ["Serial RX connected to PZEM TX", "pin"],
pin_pzem_tx: ["Serial TX connected to PZEM RX", "pin"],
pin_relay1: ["Relay 1", "pin"],
pin_relay2: ["Relay 2", "pin"],
pin_zcd: ["Zero-Cross Detection", "pin"],

"Enable / Disable": "TITLE",
ap_mode_enable: ["Enable Access Point Mode", "switch"],
debug_enable: ["Enable Debug Logging", "switch"],
disp_enable: ["Enable Display (display is connected)", "switch"],
ds18_sys_enable: ["Enable DS18 for Router (DS18 sensor is connected)", "switch"],
ha_disco_enable: ["Enable Home Assistant Integration", "switch"],
jsy_enable: ["Enable JSY (JSY board is connected)", "switch"],
lights_enable: ["Enable LEDs (Traffic Light LEDs are connected)", "switch"],
mqtt_enable: ["Enable MQTT", "switch"],
o1_ab_enable: ["Enable Output 1 automatic bypass based on temperature, days and hours", "switch"],
o1_ad_enable: ["Enable Output 1 automatic routing based on grid power", "switch"],
o1_ds18_enable: ["Enable Output 1 temperature (DS18 sensor is connected)", "switch"],
o1_enable: ["Enable Output 1 (dimmer is connected)", "switch"],
o1_pzem_enable: ["Enable Output 1 PZEM (PZEM is connected)", "switch"],
o1_relay_enable: ["Enable Output 1 Bypass Relay (relay is connected)", "switch"],
o2_ab_enable: ["Enable Output 2 automatic bypass based on temperature, days and hours", "switch"],
o2_ad_enable: ["Enable Output 2 automatic routing based on grid power", "switch"],
o2_ds18_enable: ["Enable Output 2 temperature (DS18 sensor is connected)", "switch"],
o2_enable: ["Enable Output 2 (dimmer is connected)", "switch"],
o2_pzem_enable: ["Enable Output 2 PZEM (PZEM is connected)", "switch"],
o2_relay_enable: ["Enable Output 2 Bypass Relay (relay is connected)", "switch"],
relay1_enable: ["Enable Relay 1", "switch"],
relay2_enable: ["Enable Relay 2", "switch"],
zcd_enable: ["Enable Zero-Cross Detection", "switch"],

Display: "TITLE",
dp_enable: ["Display enabled ?", "switch"],
dp_clock_pin: ["Display clock GPIO pin", "pin"],
dp_data_pin: ["Display Data GPIO pin", "pin"],
dp_type: ["Display type", "select", "SH1106,SH1107,SSD1306"],
dp_rotation: ["Display rotation", "select", "0,90,180,270"],
dp_powsave: ["Display power saving delay (in seconds)", "uint"],
disp_type: ["Display type", "select", "SH1106,SH1107,SSD1306"],
disp_angle: ["Display rotation", "select", "0,90,180,270"],

Electricity: "TITLE",
jsy_enable: ["JSY enabled ?", "switch"],
jsy_rx_pin: ["GPIO pin connected to JSY RX (Serial TX)", "pin"],
jsy_tx_pin: ["GPIO pin connected to JSY TX (Serial RX)", "pin"],
zcd_enable: ["Zero-cross detection enabled ?", "switch"],
zcd_pin: ["GPIO pin connected to zero-cross detection", "pin"],
grid_freq: ["Grid frequency", "select", "50,60"],
grid_pow_mqtt: ["Grid power MQTT topic", "string"],
grid_pow_mqtt: ["Grid power read from MQTT topic", "string"],
grid_volt: ["Grid voltage", "select", "230,110"],
grid_volt_mqtt: ["Grid voltage MQTT topic", "string"],
out1_pz_enable: ["Output 1 PZEM", "switch"],
out2_pz_enable: ["Output 2 PZEM", "switch"],
pzem_rx_pin: ["GPIO pin connected to PZEM RX (Serial TX)", "pin"],
pzem_tx_pin: ["GPIO pin connected to PZEM TX (Serial RX)", "pin"],
grid_volt_mqtt: ["Grid voltage read MQTT topic", "string"],

MQTT: "TITLE",
mqtt_enable: ["MQTT enabled ?", "switch"],
mqtt_secure: ["MQTT secure connection ?", "switch"],
mqtt_server: ["MQTT server address", "string"],
mqtt_port: ["MQTT server port", "uint"],
mqtt_user: ["MQTT username", "string"],
mqtt_pwd: ["MQTT password", "string"],
mqtt_topic: ["MQTT topic", "string"],
mqtt_pub_itvl: ["MQTT publish interval (in seconds)", "uint"],
ha_disco_enable: ["Home Assistant Discovery enabled ?", "switch"],
ha_disco_topic: ["Home Assistant Discovery topic", "string"],

Network: "TITLE",
hostname: ["Hostname", "string"],
admin_pwd: ["Admin password", "password"],
wifi_ssid: ["WiFi SSID", "string"],
wifi_pwd: ["WiFi password", "password"],
wifi_timeout: [
"WiFi connection timeout in seconds (before starting Captive Portal)",
"uint",
],
portal_timeout: [
"Captive Portal timeout in seconds (before restarting)",
"uint",
],
ntp_server: ["NTP server address", "string"],
ntp_timezone: ["NTP timezone", "tz"],
ap_mode_enable: ["Access Point mode enabled ?", "switch"],

"Output 1": "TITLE",
out1_dim_enable: ["Output 1 dimmer enabled ?", "switch"],
out1_dim_pin: ["Output 1 dimmer GPIO pin", "pin"],
out1_dim_type: [
"Output 1 dimmer type",
"select",
"TRIAC,SSR RANDOM,SSR ZC",
],
out1_dim_auto: ["Output 1 dimmer auto mode", "switch"],
out1_dim_limit: ["Output 1 dimmer limit", "percent"],
out1_tmp_enable: ["Output 1 temperature sensor enabled ?", "switch"],
out1_tmp_pin: ["Output 1 temperature sensor GPIO pin", "pin"],
out1_bp_enable: ["Output 1 bypass relay enabled ?", "switch"],
out1_bp_pin: ["Output 1 bypass relay GPIO pin", "pin"],
out1_bp_type: ["Output 1 bypass relay type", "select", "NO,NC"],
out1_aut_enable: ["Output 1 bypass auto mode", "switch"],
out1_wdays: ["Output 1 auto bypass weekdays", "string"],
out1_start_time: ["Output 1 auto bypass start time", "time"],
out1_end_time: ["Output 1 auto bypass end time", "time"],
out1_tmp_low: ["Output 1 auto bypass start temperature", "uint"],
out1_tmp_high: ["Output 1 auto bypass stop temperature", "uint"],
o1_dim_limit: ["Output 1 dimmer limiter (limit dimmer level)", "percent"],
o1_relay_type: ["Output 1 bypass relay type", "select", "NO,NC"],
o1_days: ["Output 1 auto bypass weekdays", "string"],
o1_time_start: ["Output 1 auto bypass start time", "time"],
o1_time_stop: ["Output 1 auto bypass stop time", "time"],
o1_temp_start: ["Output 1 auto bypass start temperature", "uint"],
o1_temp_stop: ["Output 1 auto bypass stop temperature", "uint"],

"Output 2": "TITLE",
out2_dim_enable: ["Output 2 dimmer enabled ?", "switch"],
out2_dim_pin: ["Output 2 dimmer GPIO pin", "pin"],
out2_dim_type: [
"Output 2 dimmer type",
"select",
"TRIAC,SSR RANDOM,SSR ZC",
],
out2_dim_auto: ["Output 2 dimmer auto mode", "switch"],
out2_dim_limit: ["Output 2 dimmer limit", "percent"],
out2_tmp_enable: ["Output 2 temperature sensor enabled ?", "switch"],
out2_tmp_pin: ["Output 2 temperature sensor GPIO pin", "pin"],
out2_bp_enable: ["Output 2 bypass relay enabled ?", "switch"],
out2_bp_pin: ["Output 2 bypass relay GPIO pin", "pin"],
out2_bp_type: ["Output 2 bypass relay type", "select", "NO,NC"],
out2_aut_enable: ["Output 2 bypass auto mode", "switch"],
out2_wdays: ["Output 2 auto bypass weekdays", "string"],
out2_start_time: ["Output 2 auto bypass start time", "time"],
out2_end_time: ["Output 2 auto bypass end time", "time"],
out2_tmp_low: ["Output 2 auto bypass start temperature", "uint"],
out2_tmp_high: ["Output 2 auto bypass stop temperature", "uint"],
o2_dim_limit: ["Output 2 dimmer limiter (limit dimmer level)", "percent"],
o2_relay_type: ["Output 2 bypass relay type", "select", "NO,NC"],
o2_days: ["Output 2 auto bypass weekdays", "string"],
o2_time_start: ["Output 2 auto bypass start time", "time"],
o2_time_stop: ["Output 2 auto bypass stop time", "time"],
o2_temp_start: ["Output 2 auto bypass start temperature", "uint"],
o2_temp_stop: ["Output 2 auto bypass stop temperature", "uint"],

"Relay 1": "TITLE",
relay1_enable: ["Relay 1 enabled ?", "switch"],
relay1_pin: ["Relay 1 GPIO pin", "pin"],
relay1_type: ["Relay 1 type", "select", "NO,NC"],
relay1_power: ["Relay 1 power threshold", "uint"],
relay1_load: ["Load in Watts connected to Relay 1 (to activate automatic relay switching)", "uint"],

"Relay 2": "TITLE",
relay2_enable: ["Relay 2 enabled ?", "switch"],
relay2_pin: ["Relay 2 GPIO pin", "pin"],
relay2_type: ["Relay 2 type", "select", "NO,NC"],
relay2_power: ["Relay 2 power threshold", "uint"],

System: "TITLE",
sys_tmp_enable: ["System temperature sensor enabled ?", "switch"],
sys_tmp_pin: ["System temperature sensor GPIO pin", "pin"],
buzzer_enable: ["Buzzer enabled ?", "switch"],
buzzer_pin: ["Buzzer GPIO pin", "pin"],
lights_enable: ["LEDs enabled ?", "switch"],
lights_g_pin: ["LED green GPIO pin", "pin"],
lights_r_pin: ["LED red GPIO pin", "pin"],
lights_y_pin: ["LED yellow GPIO pin", "pin"],
button_enable: ["Push Button enabled ?", "switch"],
button_pin: ["Push Button GPIO pin", "pin"],
button_action: [
"Action to perform when button is pressed",
"select",
"restart,bypass",
],
relay2_load: ["Load in Watts connected to Relay 2 (to activate automatic relay switching)", "uint"],
};

async function onInputChange(event) {
Expand Down Expand Up @@ -334,7 +305,7 @@ <h1>YaSolR Configuration</h1>
});

Promise.all(
["/api/config", "/api/ntp/timezones"].map((u) =>
["/api/config", "/timezones"].map((u) =>
fetch(u).then((resp) => resp.json())
)
)
Expand All @@ -344,7 +315,7 @@ <h1>YaSolR Configuration</h1>
const timezones = json[1];
const table = document.getElementById("config-table");
for (const k in config) {
if(supportedConfig[k] == undefined) {
if (supportedConfig[k] == undefined) {
console.error("Unsupported config key", k);
}
}
Expand Down
Loading

0 comments on commit de94af1

Please sign in to comment.