mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-11-14 18:58:49 -05:00
this is a big slop that might backfire lol... new config system and UI!
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Lift Configuration
|
||||
// Purpose: Defines lift switch mappings and command timing nested beneath Home Assistant.
|
||||
// Scope: Exports a nested configuration fragment without initializing either service.
|
||||
const { strictObject, string, boolean, integer } = require('../../configuration/schemaHelpers');
|
||||
|
||||
module.exports = {
|
||||
key: 'lift',
|
||||
feature: true,
|
||||
defaultValue: { enabled: false, upSwitch: '', downSwitch: '', interlockMs: 2000, commandCooldownMs: 3000 },
|
||||
schema: strictObject({
|
||||
enabled: boolean(),
|
||||
upSwitch: string({ maxLength: 255 }),
|
||||
downSwitch: string({ maxLength: 255 }),
|
||||
interlockMs: integer({ minimum: 0, maximum: 600000 }),
|
||||
commandCooldownMs: integer({ minimum: 0, maximum: 600000 }),
|
||||
}, { title: 'Lift', required: ['enabled', 'upSwitch', 'downSwitch', 'interlockMs', 'commandCooldownMs'] }),
|
||||
};
|
||||
@@ -4,8 +4,7 @@
|
||||
const EventEmitter = require('events');
|
||||
const io = require('../../globals/io');
|
||||
const logger = require('../../globals/logger').child('liftService');
|
||||
const { loadConfig } = require('../../helpers/configLoader');
|
||||
const { isFeatureEnabled } = require('../../helpers/features');
|
||||
const { loadConfig } = require('../../configuration');
|
||||
const { getMode, MODES } = require('../modeManager');
|
||||
const { isAdmin, isLockdownAdmin } = require('../roleService');
|
||||
const {
|
||||
@@ -20,7 +19,7 @@ const events = new EventEmitter();
|
||||
const config = loadConfig();
|
||||
const haConfig = config.homeAssistant || {};
|
||||
const liftConfig = haConfig.lift || {};
|
||||
const featureEnabled = isFeatureEnabled('lift');
|
||||
const featureEnabled = Boolean(liftConfig.enabled);
|
||||
|
||||
const upSwitchId = String(liftConfig.upSwitch || '').trim();
|
||||
const downSwitchId = String(liftConfig.downSwitch || '').trim();
|
||||
@@ -73,7 +72,7 @@ function getState() {
|
||||
const configured = isConfigured();
|
||||
const connected = isHomeAssistantConnected();
|
||||
return {
|
||||
enabled: Boolean(featureEnabled && homeAssistantEnabled && configured),
|
||||
enabled: featureEnabled,
|
||||
configured,
|
||||
connected,
|
||||
entities: {
|
||||
|
||||
Reference in New Issue
Block a user