mirror of
https://github.com/adrianjagielak/home-assistant-futurehome.git
synced 2025-11-18 17:19:02 +00:00
Allow empty Thingsplex credentials (#3)
This commit is contained in:
@@ -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
|
||||
) {
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user