Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
41 changes: 31 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
# IDE and Tooling
.theia/
.vscode/
.claude/
.pio/
debug_custom.json
debug.cfg

# Hardware / SVD Files
esp32.vsd
esp32s3.svd
debug.cfg

SomfyController.ino.XIAO_ESP32S3.bin
SomfyController.ino.esp32c3.bin
SomfyController.ino.esp32s2.bin
.vscode/
.pio/
.claude/
data/
# Build, Logs and Output Folders
build/
coredump_report.txt
coredump.bin
data/
logs/
managed_components/

# ESP-IDF Specific
sdkconfig
sdkconfig.old
sdkconfig.*

# Binary and Archive Files
*.elf
elf_archive/
coredump_report.txt
coredump.bin

# Project Specific / Generated Source
src/SomfyController.ino.cpp

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

# Temporary and Backup Files
*.orig
*.bak
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)
])
48 changes: 41 additions & 7 deletions data-src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
//var hst = '192.168.1.208';
var hst = '192.168.1.152';
//var hst = '192.168.1.159';
/**
* hst is a development convenience variable: it's a hardcoded IP address used when the HTML file is opened directly
* from the filesystem (i.e., file:// protocol) rather than served from the ESP32.
* Adapt the IP accordingly based on your router configuration.
**/
var hst = '192.168.178.20';
Comment thread
cjkas marked this conversation as resolved.
var _rooms = [{ roomId: 0, name: 'Home' }];

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

// let appVersion = 'v3.0.11'; // 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 = 'v3.0.11'; // 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 +2816,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: [] },
Comment thread
cjkas marked this conversation as resolved.
{ 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: [] }
Comment thread
cjkas marked this conversation as resolved.
];

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 +4837,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