From 91a3272780b75726c06e95106ea4c426b36b5c3f Mon Sep 17 00:00:00 2001 From: legop3 Date: Wed, 29 Apr 2026 19:22:21 -0400 Subject: [PATCH] ohyeah --- server/src/services/liftService/index.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/src/services/liftService/index.js b/server/src/services/liftService/index.js index 9ff6a5ab..ab3abaf9 100644 --- a/server/src/services/liftService/index.js +++ b/server/src/services/liftService/index.js @@ -9,7 +9,7 @@ const { isVerified } = require('../verificationService'); const { homeAssistantEvents, getRawEntitySnapshot, - setEntityState, + callHomeAssistantService, isConnected: isHomeAssistantConnected, enabled: homeAssistantEnabled, } = require('../homeAssistantService'); @@ -102,15 +102,20 @@ function assertReady() { } async function applyPosition(target) { + async function setSwitch(entityId, desiredState) { + const service = desiredState === 'on' ? 'turn_on' : 'turn_off'; + await callHomeAssistantService('switch', service, { entity_id: entityId }); + } + if (target === 'up') { - await setEntityState(downSwitchId, 'off'); + await setSwitch(downSwitchId, 'off'); await sleep(interlockMs); - await setEntityState(upSwitchId, 'on'); + await setSwitch(upSwitchId, 'on'); return; } - await setEntityState(upSwitchId, 'off'); + await setSwitch(upSwitchId, 'off'); await sleep(interlockMs); - await setEntityState(downSwitchId, 'on'); + await setSwitch(downSwitchId, 'on'); } async function requestPosition(target, actor = 'unknown') {