From 57124f6b4c655027824b339e2b3398d6b0e5da64 Mon Sep 17 00:00:00 2001 From: Adrian Jagielak Date: Wed, 24 Sep 2025 21:15:54 +0200 Subject: [PATCH] Allow empty Thingsplex credentials (#3) --- futurehome/config.yaml | 2 ++ futurehome/rootfs/etc/services.d/futurehome/run | 1 + futurehome/src/ha/publish_device.ts | 5 +++-- futurehome/src/index.ts | 4 +++- futurehome/src/services/parameters.ts | 4 ++-- futurehome/translations/be.yaml | 3 +++ futurehome/translations/by.yaml | 3 +++ futurehome/translations/cs.yaml | 3 +++ futurehome/translations/cz.yaml | 3 +++ futurehome/translations/da.yaml | 3 +++ futurehome/translations/de.yaml | 3 +++ futurehome/translations/dk.yaml | 3 +++ futurehome/translations/ee.yaml | 3 +++ futurehome/translations/en.yaml | 3 +++ futurehome/translations/et.yaml | 3 +++ futurehome/translations/fi.yaml | 3 +++ futurehome/translations/is.yaml | 3 +++ futurehome/translations/lt.yaml | 3 +++ futurehome/translations/lv.yaml | 3 +++ futurehome/translations/nb.yaml | 3 +++ futurehome/translations/nn.yaml | 3 +++ futurehome/translations/no.yaml | 3 +++ futurehome/translations/pl.yaml | 3 +++ futurehome/translations/ru.yaml | 3 +++ futurehome/translations/se.yaml | 3 +++ futurehome/translations/sk.yaml | 3 +++ futurehome/translations/sv.yaml | 3 +++ futurehome/translations/ua.yaml | 3 +++ futurehome/translations/uk.yaml | 3 +++ 29 files changed, 83 insertions(+), 5 deletions(-) diff --git a/futurehome/config.yaml b/futurehome/config.yaml index 184d458..5d18310 100644 --- a/futurehome/config.yaml +++ b/futurehome/config.yaml @@ -21,6 +21,7 @@ options: fh_password: '' tp_username: '' tp_password: '' + tp_allow_empty: false demo_mode: false show_debug_log: false @@ -30,6 +31,7 @@ schema: fh_password: 'password?' tp_username: 'str?' tp_password: 'password?' + tp_allow_empty: 'bool?' demo_mode: 'bool?' show_debug_log: 'bool?' diff --git a/futurehome/rootfs/etc/services.d/futurehome/run b/futurehome/rootfs/etc/services.d/futurehome/run index 6d74cc8..2654ed1 100755 --- a/futurehome/rootfs/etc/services.d/futurehome/run +++ b/futurehome/rootfs/etc/services.d/futurehome/run @@ -10,6 +10,7 @@ export FH_USERNAME=$(bashio::config 'fh_username') export FH_PASSWORD=$(bashio::config 'fh_password') export TP_USERNAME=$(bashio::config 'tp_username') export TP_PASSWORD=$(bashio::config 'tp_password') +export TP_ALLOW_EMPTY=$(bashio::config 'tp_allow_empty') export DEMO_MODE=$(bashio::config 'demo_mode') export SHOW_DEBUG_LOG=$(bashio::config 'show_debug_log') diff --git a/futurehome/src/ha/publish_device.ts b/futurehome/src/ha/publish_device.ts index ae72a89..4123ec8 100644 --- a/futurehome/src/ha/publish_device.ts +++ b/futurehome/src/ha/publish_device.ts @@ -208,6 +208,7 @@ export function haPublishDevice(parameters: { deviceInclusionReport: InclusionReport | undefined; thingsplexUsername: string; thingsplexPassword: string; + thingsplexAllowEmpty: boolean; }): { commandHandlers: CommandHandlers } { const components: { [key: string]: HaMqttComponent } = {}; const handlers: CommandHandlers = {}; @@ -261,8 +262,8 @@ export function haPublishDevice(parameters: { } if ( - parameters.thingsplexUsername && - parameters.thingsplexPassword && + (parameters.thingsplexAllowEmpty || + (parameters.thingsplexUsername && parameters.thingsplexPassword)) && parameters.vinculumDeviceData.fimp?.address && parameters.vinculumDeviceData.fimp?.adapter ) { diff --git a/futurehome/src/index.ts b/futurehome/src/index.ts index 93acadf..225bec5 100644 --- a/futurehome/src/index.ts +++ b/futurehome/src/index.ts @@ -22,6 +22,7 @@ import { pollVinculum } from './fimp/vinculum'; const localApiPassword = process.env.FH_PASSWORD || ''; const thingsplexUsername = process.env.TP_USERNAME || ''; const thingsplexPassword = process.env.TP_PASSWORD || ''; + const thingsplexAllowEmpty = (process.env.TP_ALLOW_EMPTY || '').toLowerCase().includes('true'); const demoMode = (process.env.DEMO_MODE || '').toLowerCase().includes('true'); const showDebugLog = (process.env.SHOW_DEBUG_LOG || '') .toLowerCase() @@ -166,6 +167,7 @@ import { pollVinculum } from './fimp/vinculum'; deviceInclusionReport, thingsplexUsername, thingsplexPassword, + thingsplexAllowEmpty, }); await delay(50); @@ -189,7 +191,7 @@ import { pollVinculum } from './fimp/vinculum'; log.error('Failed publishing device', device, e); } } - if (demoMode || (thingsplexUsername && thingsplexPassword)) { + if (demoMode || thingsplexAllowEmpty || (thingsplexUsername && thingsplexPassword)) { Object.assign( commandHandlers, exposeSmarthubTools({ diff --git a/futurehome/src/services/parameters.ts b/futurehome/src/services/parameters.ts index eddac7f..864475c 100644 --- a/futurehome/src/services/parameters.ts +++ b/futurehome/src/services/parameters.ts @@ -20,7 +20,7 @@ export function parameters__components( const commandHandlers: CommandHandlers = {}; const stateTopic = `${topicPrefix}/state`; - // Fetch cached state for this service to discover known parameters :contentReference[oaicite:2]{index=2} + // Fetch cached state for this service to discover known parameters const currentState = haGetCachedState({ topic: stateTopic })?.[svc.addr]; const paramMap = currentState?.param; if (!paramMap) { @@ -31,7 +31,7 @@ export function parameters__components( // Single MQTT topic for setting any parameter const setParamTopic = `${topicPrefix}${svc.addr}/set_param/command`; - // Iterate over each parameter in the cached state :contentReference[oaicite:3]{index=3} + // Iterate over each parameter in the cached state for (const [paramId, param] of Object.entries(paramMap)) { const valueType = (param as any).value_type as string; const uniqueId = `${svc.addr}_${paramId}`; diff --git a/futurehome/translations/be.yaml b/futurehome/translations/be.yaml index 9a0d990..c0ae0ed 100644 --- a/futurehome/translations/be.yaml +++ b/futurehome/translations/be.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Пароль Thingsplex (неабавязкова) description: Ваш пароль для Thingsplex. + tp_allow_empty: + name: Дазволіць пустыя ўліковыя дадзеныя Thingsplex + description: Дазволіць пустое імя карыстальніка і/або пароль Thingsplex. demo_mode: name: Дэманстрацыйны рэжым description: Выкарыстоўвайце запісаны стан з рэальнага Futurehome Smarthub для мадэлявання прылад. diff --git a/futurehome/translations/by.yaml b/futurehome/translations/by.yaml index 9a0d990..c0ae0ed 100644 --- a/futurehome/translations/by.yaml +++ b/futurehome/translations/by.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Пароль Thingsplex (неабавязкова) description: Ваш пароль для Thingsplex. + tp_allow_empty: + name: Дазволіць пустыя ўліковыя дадзеныя Thingsplex + description: Дазволіць пустое імя карыстальніка і/або пароль Thingsplex. demo_mode: name: Дэманстрацыйны рэжым description: Выкарыстоўвайце запісаны стан з рэальнага Futurehome Smarthub для мадэлявання прылад. diff --git a/futurehome/translations/cs.yaml b/futurehome/translations/cs.yaml index 3994f59..4d1f40b 100644 --- a/futurehome/translations/cs.yaml +++ b/futurehome/translations/cs.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Heslo Thingsplex (volitelné) description: Vaše heslo pro Thingsplex. + tp_allow_empty: + name: Povolit prázdné přihlašovací údaje Thingsplex + description: Povolit prázdné uživatelské jméno a/nebo heslo Thingsplex. demo_mode: name: Demo režim description: Použijte uložený stav ze skutečného Futurehome Smarthubu pro simulaci zařízení. diff --git a/futurehome/translations/cz.yaml b/futurehome/translations/cz.yaml index 3994f59..4d1f40b 100644 --- a/futurehome/translations/cz.yaml +++ b/futurehome/translations/cz.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Heslo Thingsplex (volitelné) description: Vaše heslo pro Thingsplex. + tp_allow_empty: + name: Povolit prázdné přihlašovací údaje Thingsplex + description: Povolit prázdné uživatelské jméno a/nebo heslo Thingsplex. demo_mode: name: Demo režim description: Použijte uložený stav ze skutečného Futurehome Smarthubu pro simulaci zařízení. diff --git a/futurehome/translations/da.yaml b/futurehome/translations/da.yaml index be8f13f..6177ab5 100644 --- a/futurehome/translations/da.yaml +++ b/futurehome/translations/da.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-adgangskode (valgfri) description: Din Thingsplex-adgangskode. + tp_allow_empty: + name: Tillad tomme Thingsplex-legitimationsoplysninger + description: Tillad tomt Thingsplex-brugernavn og/eller adgangskode. demo_mode: name: Demotilstand description: Brug en optaget prøvetilstand fra en rigtig Futurehome Smarthub til at simulere enheder. diff --git a/futurehome/translations/de.yaml b/futurehome/translations/de.yaml index d811df9..04aadbe 100644 --- a/futurehome/translations/de.yaml +++ b/futurehome/translations/de.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-Passwort (optional) description: Dein Thingsplex-Passwort. + tp_allow_empty: + name: Leere Thingsplex-Anmeldedaten zulassen + description: Leeren Thingsplex-Benutzernamen und/oder Passwort zulassen. demo_mode: name: Demo-Modus description: Verwende einen aufgezeichneten Beispielzustand eines echten Futurehome Smarthubs, um Geräte zu simulieren. diff --git a/futurehome/translations/dk.yaml b/futurehome/translations/dk.yaml index be8f13f..6177ab5 100644 --- a/futurehome/translations/dk.yaml +++ b/futurehome/translations/dk.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-adgangskode (valgfri) description: Din Thingsplex-adgangskode. + tp_allow_empty: + name: Tillad tomme Thingsplex-legitimationsoplysninger + description: Tillad tomt Thingsplex-brugernavn og/eller adgangskode. demo_mode: name: Demotilstand description: Brug en optaget prøvetilstand fra en rigtig Futurehome Smarthub til at simulere enheder. diff --git a/futurehome/translations/ee.yaml b/futurehome/translations/ee.yaml index 55515bf..520d9aa 100644 --- a/futurehome/translations/ee.yaml +++ b/futurehome/translations/ee.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplexi parool (valikuline) description: Sinu Thingsplexi parool. + tp_allow_empty: + name: Luba tühjad Thingsplexi mandaadid + description: Luba tühi Thingsplexi kasutajanimi ja/või parool. demo_mode: name: Demorežiim description: Kasuta päris Futurehome Smarthubist salvestatud näidisseisu seadmete simuleerimiseks. diff --git a/futurehome/translations/en.yaml b/futurehome/translations/en.yaml index b1f5116..683bc56 100644 --- a/futurehome/translations/en.yaml +++ b/futurehome/translations/en.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex Password (Optional) description: Your Thingsplex password. + tp_allow_empty: + name: Allow Empty Thingsplex Credentials + description: Allow empty Thingsplex username and/or password. demo_mode: name: Demo Mode description: Use a sample recorded state from a real Futurehome Smarthub to simulate devices. diff --git a/futurehome/translations/et.yaml b/futurehome/translations/et.yaml index 55515bf..520d9aa 100644 --- a/futurehome/translations/et.yaml +++ b/futurehome/translations/et.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplexi parool (valikuline) description: Sinu Thingsplexi parool. + tp_allow_empty: + name: Luba tühjad Thingsplexi mandaadid + description: Luba tühi Thingsplexi kasutajanimi ja/või parool. demo_mode: name: Demorežiim description: Kasuta päris Futurehome Smarthubist salvestatud näidisseisu seadmete simuleerimiseks. diff --git a/futurehome/translations/fi.yaml b/futurehome/translations/fi.yaml index 4adea34..3b9c20f 100644 --- a/futurehome/translations/fi.yaml +++ b/futurehome/translations/fi.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-salasana (valinnainen) description: Thingsplex-salasanasi. + tp_allow_empty: + name: Salli tyhjät Thingsplex-tunnistetiedot + description: Salli tyhjä Thingsplex-käyttäjätunnus ja/tai salasana. demo_mode: name: Demotila description: Käytä tallennettua tilanäytettä oikeasta Futurehome Smarthubista laitteiden simuloimiseen. diff --git a/futurehome/translations/is.yaml b/futurehome/translations/is.yaml index d0b8ffa..db40acf 100644 --- a/futurehome/translations/is.yaml +++ b/futurehome/translations/is.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex lykilorð (valkvætt) description: Lykilorðið þitt fyrir Thingsplex. + tp_allow_empty: + name: Leyfa tómar Thingsplex-auðkenningar + description: Leyfa tómt Thingsplex-notandanafn og/eða lykilorð. demo_mode: name: Sýnishamur description: Notaðu upptaka af raunverulegu ástandi úr Futurehome Smarthub til að herma eftir tækjum. diff --git a/futurehome/translations/lt.yaml b/futurehome/translations/lt.yaml index f358a58..b09b677 100644 --- a/futurehome/translations/lt.yaml +++ b/futurehome/translations/lt.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex slaptažodis (pasirinktinai) description: Jūsų Thingsplex slaptažodis. + tp_allow_empty: + name: Leisti tuščius „Thingsplex“ prisijungimo duomenis + description: Leisti tuščią „Thingsplex“ vartotojo vardą ir (arba) slaptažodį. demo_mode: name: Demonstracinis režimas description: Naudokite įrašytą būsena iš tikro Futurehome Smarthub, kad imituotumėte įrenginius. diff --git a/futurehome/translations/lv.yaml b/futurehome/translations/lv.yaml index 2eb08c2..56b3e60 100644 --- a/futurehome/translations/lv.yaml +++ b/futurehome/translations/lv.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex parole (pēc izvēles) description: Tava Thingsplex parole. + tp_allow_empty: + name: Atļaut tukšus Thingsplex akreditācijas datus + description: Atļaut tukšu Thingsplex lietotājvārdu un/vai paroli. demo_mode: name: Demonstrācijas režīms description: Izmanto ierakstītu stāvokli no īsta Futurehome Smarthub, lai simulētu ierīces. diff --git a/futurehome/translations/nb.yaml b/futurehome/translations/nb.yaml index 802ef1a..c134bf2 100644 --- a/futurehome/translations/nb.yaml +++ b/futurehome/translations/nb.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-passord (valgfritt) description: Ditt passord for Thingsplex. + tp_allow_empty: + name: Tillat tomme Thingsplex-legitimasjoner + description: Tillat tomt Thingsplex-brukernavn og/eller passord. demo_mode: name: Demomodus description: Bruk en forhåndsopptatt tilstand fra en ekte Futurehome Smarthub for å simulere enheter. diff --git a/futurehome/translations/nn.yaml b/futurehome/translations/nn.yaml index bccea47..c93e01a 100644 --- a/futurehome/translations/nn.yaml +++ b/futurehome/translations/nn.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-passord (valfritt) description: Ditt passord for Thingsplex. + tp_allow_empty: + name: Tillat tomme Thingsplex-legitimasjonar + description: Tillat tomt Thingsplex-brukarnamn og/eller passord. demo_mode: name: Demomodus description: Bruk ein førehandsopptak frå ein ekte Futurehome Smarthub for å simulere einingar. diff --git a/futurehome/translations/no.yaml b/futurehome/translations/no.yaml index 802ef1a..c134bf2 100644 --- a/futurehome/translations/no.yaml +++ b/futurehome/translations/no.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-passord (valgfritt) description: Ditt passord for Thingsplex. + tp_allow_empty: + name: Tillat tomme Thingsplex-legitimasjoner + description: Tillat tomt Thingsplex-brukernavn og/eller passord. demo_mode: name: Demomodus description: Bruk en forhåndsopptatt tilstand fra en ekte Futurehome Smarthub for å simulere enheter. diff --git a/futurehome/translations/pl.yaml b/futurehome/translations/pl.yaml index e46fbeb..0434a6d 100644 --- a/futurehome/translations/pl.yaml +++ b/futurehome/translations/pl.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Hasło do Thingsplex (opcjonalne) description: Twoje hasło do Thingsplex. + tp_allow_empty: + name: Zezwól na puste dane logowania Thingsplex + description: Zezwól na puste nazwy użytkownika i/lub hasła Thingsplex. demo_mode: name: Tryb demonstracyjny description: Użyj zapisanego stanu z prawdziwego Futurehome Smarthub, aby symulować urządzenia. diff --git a/futurehome/translations/ru.yaml b/futurehome/translations/ru.yaml index 799403e..0c3152b 100644 --- a/futurehome/translations/ru.yaml +++ b/futurehome/translations/ru.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Пароль Thingsplex (необязательно) description: Ваш пароль Thingsplex. + tp_allow_empty: + name: Разрешить пустые учетные данные Thingsplex + description: Разрешить пустое имя пользователя и/или пароль Thingsplex. demo_mode: name: Демонстрационный режим description: Используйте сохранённое состояние от настоящего Futurehome Smarthub для имитации устройств. diff --git a/futurehome/translations/se.yaml b/futurehome/translations/se.yaml index 6ebfbcb..44669ac 100644 --- a/futurehome/translations/se.yaml +++ b/futurehome/translations/se.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-lösenord (valfritt) description: Ditt lösenord för Thingsplex. + tp_allow_empty: + name: Tillåt tomma Thingsplex-uppgifter + description: Tillåt tomt Thingsplex-användarnamn och/eller lösenord. demo_mode: name: Demoläge description: Använd ett inspelat exempel från en riktig Futurehome Smarthub för att simulera enheter. diff --git a/futurehome/translations/sk.yaml b/futurehome/translations/sk.yaml index f62db61..5c54892 100644 --- a/futurehome/translations/sk.yaml +++ b/futurehome/translations/sk.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Heslo Thingsplex (voliteľné) description: Vaše heslo pre Thingsplex. + tp_allow_empty: + name: Povoliť prázdne prihlasovacie údaje Thingsplex + description: Povoliť prázdne používateľské meno a/alebo heslo Thingsplex. demo_mode: name: Demo režim description: Použite uložený stav zo skutočného Futurehome Smarthubu na simuláciu zariadení. diff --git a/futurehome/translations/sv.yaml b/futurehome/translations/sv.yaml index 6ebfbcb..44669ac 100644 --- a/futurehome/translations/sv.yaml +++ b/futurehome/translations/sv.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Thingsplex-lösenord (valfritt) description: Ditt lösenord för Thingsplex. + tp_allow_empty: + name: Tillåt tomma Thingsplex-uppgifter + description: Tillåt tomt Thingsplex-användarnamn och/eller lösenord. demo_mode: name: Demoläge description: Använd ett inspelat exempel från en riktig Futurehome Smarthub för att simulera enheter. diff --git a/futurehome/translations/ua.yaml b/futurehome/translations/ua.yaml index 9b60a5e..913ed9b 100644 --- a/futurehome/translations/ua.yaml +++ b/futurehome/translations/ua.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Пароль Thingsplex (необов’язково) description: Ваш пароль для Thingsplex. + tp_allow_empty: + name: Дозволити порожні облікові дані Thingsplex + description: Дозволити порожнє ім’я користувача та/або пароль Thingsplex. demo_mode: name: Демонстраційний режим description: Використовуйте записаний стан із реального Futurehome Smarthub для імітації пристроїв. diff --git a/futurehome/translations/uk.yaml b/futurehome/translations/uk.yaml index 9b60a5e..913ed9b 100644 --- a/futurehome/translations/uk.yaml +++ b/futurehome/translations/uk.yaml @@ -14,6 +14,9 @@ configuration: tp_password: name: Пароль Thingsplex (необов’язково) description: Ваш пароль для Thingsplex. + tp_allow_empty: + name: Дозволити порожні облікові дані Thingsplex + description: Дозволити порожнє ім’я користувача та/або пароль Thingsplex. demo_mode: name: Демонстраційний режим description: Використовуйте записаний стан із реального Futurehome Smarthub для імітації пристроїв.