Skip to content
Open
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
26 changes: 25 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,37 @@ debug_custom.json
esp32.vsd
esp32s3.svd
debug.cfg
data/
build/
coredump_report.txt
coredump.bin
logs/
managed_components/

#Ignore Somfy INO/Bin files
SomfyController.ino.XIAO_ESP32S3.bin
SomfyController.ino.esp32c3.bin
SomfyController.ino.esp32s2.bin

#Ignore IDE files
.vscode/
.pio/
.claude/

# Ignore ELF binary archives
elf_archive/
*.elf

# Ignore PlatformIO build folder
.pio/

# Ignore auto-generated ESP-IDF files
sdkconfig
sdkconfig.old
sdkconfig.*

# Ignore temporary backup files
*.orig
*.bak
data/
build/
coredump_report.txt
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(ESPSomfy-RTS)
32 changes: 32 additions & 0 deletions app_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import os
Import("env")

# Define the folder and filename
DATA_FOLDER = "data-src"
FILENAME = "appversion"

# Construct the full path: /your/project/path/data-src/appversion
project_dir = env.get("PROJECT_DIR")
version_file_path = os.path.join(project_dir, DATA_FOLDER, FILENAME)

# Default fallback if something goes wrong
version = "0.0.0"

if os.path.exists(version_file_path):
try:
with open(version_file_path, "r") as f:
version = f.read().strip()
# Clean output for the PlatformIO console
print(f"--- SUCCESS: Found version {version} in {version_file_path} ---")
except Exception as e:
print(f"--- ERROR: could not read version file: {e} ---")
else:
print(f"--- ERROR: File NOT FOUND at {version_file_path} ---")

# Apply to the build environment
# We use escaped quotes so C++ treats it as a string literal "vX.X.X"
full_version_str = f'\\"v{version}\\"'

env.Append(CPPDEFINES=[
("FW_VERSION", full_version_str)
])
42 changes: 36 additions & 6 deletions data-src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//var hst = '192.168.1.208';
var hst = '192.168.1.152';
//var hst = '192.168.1.159';
var hst = '192.168.178.20';
var _rooms = [{ roomId: 0, name: 'Home' }];

var errors = [
Expand Down Expand Up @@ -1268,9 +1267,27 @@ class Security {
}
var security = new Security();

// let appVersion = 'v0.0.0'; // Default placeholder
async function getAppVersion() {
try {
const response = await fetch('/appversion');
if (!response.ok) throw new Error('File not found');

const data = await response.text();
appVersion = `v${data.trim()}`;

console.log("Loaded Version:", appVersion);
// Trigger any UI updates here
} catch (error) {
console.error("Error loading App version:", error);
appVersion = 'v0.0.0'; // Default placeholder
}
return appVersion;
}

class General {
initialized = false;
appVersion = 'v3.0.11';
appVersion = getAppVersion();
reloadApp = false;
init() {
if (this.initialized) return;
Expand Down Expand Up @@ -2795,16 +2812,17 @@ class Somfy {
document.getElementById('divLinkedShadeList').innerHTML = divCfg;
}
pinMaps = [
{ name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] },
{ name: '', maxPins: 39, inputs: [], outputs: [] },
{ name: 's2', maxPins: 46, inputs: [0, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 45], outputs: [0, 19, 20, 26, 27, 28, 29, 30, 31, 32, 45, 46]},
{ name: 's3', maxPins: 48, inputs: [19, 20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32], outputs: [19, 20, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32] },
{ name: 'c3', maxPins: 21, inputs: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], outputs: [11, 12, 13, 14, 15, 16, 17, 21] }
{ name: 'c3', maxPins: 21, inputs: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], outputs: [11, 12, 13, 14, 15, 16, 17, 21] },
{ name: 'c6', maxPins: 23, inputs: [], outputs: [] }
];

loadPins(type, sel, opt) {
while (sel.firstChild) sel.removeChild(sel.firstChild);
let cm = document.getElementById('divContainer').getAttribute('data-chipmodel');
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] };
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [], outputs: [] };
//console.log({ cm: cm, pm: pm });
for (let i = 0; i <= pm.maxPins; i++) {
if (type.includes('in') && pm.inputs.includes(i)) continue;
Expand Down Expand Up @@ -4815,3 +4833,15 @@ class Firmware {
}
var firmware = new Firmware();

window.addEventListener('load', async () => {
// 1. Initialize your main application logic
// await init();

// 2. Fetch and display the app version
appVersion = await getAppVersion();
const spanAppVersion = document.getElementById('spanAppVersion');
spanAppVersion.innerText = `${appVersion.trim()}`;

console.log("Application fully loaded and version updated.");
});

Loading
Loading