From ee55c23cdec0d81339f73fecd3188233ae4ce6ee Mon Sep 17 00:00:00 2001 From: Jeppe B <2jepp9350@gmail.com> Date: Mon, 1 Jun 2026 23:11:01 +0200 Subject: [PATCH] Fix hard machine relay targeting --- .../traits/selfserve_lane_relay_controller_t.php | 2 +- .../SelfserveLaneRelayShellyBatchingTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/services/nginx/app/modules/selfserve/traits/selfserve_lane_relay_controller_t.php b/services/nginx/app/modules/selfserve/traits/selfserve_lane_relay_controller_t.php index 362135a9..2778c7f7 100644 --- a/services/nginx/app/modules/selfserve/traits/selfserve_lane_relay_controller_t.php +++ b/services/nginx/app/modules/selfserve/traits/selfserve_lane_relay_controller_t.php @@ -124,7 +124,7 @@ trait selfserve_lane_relay_controller_t */ public function setMachineRelayStatusHard(bool $on): bool { - return $this->setRelayStatusHard(selfserve_lane_relay::MACHINE_PROGRAM_PICKER, $on); + return $this->setRelayStatusHard(selfserve_lane_relay::MACHINE, $on); } /** diff --git a/services/nginx/app/tests/Unit/Selfserve/SelfserveLaneRelayShellyBatchingTest.php b/services/nginx/app/tests/Unit/Selfserve/SelfserveLaneRelayShellyBatchingTest.php index 0ee52551..4d77efd0 100644 --- a/services/nginx/app/tests/Unit/Selfserve/SelfserveLaneRelayShellyBatchingTest.php +++ b/services/nginx/app/tests/Unit/Selfserve/SelfserveLaneRelayShellyBatchingTest.php @@ -332,6 +332,20 @@ it('keeps back-to-back get/switch requests ordered through the relay controller' expect($harness->shellyCalls[1]['endpoint'])->toBe('/v2/devices/api/set/switch'); }); +it('hard MACHINE relay helper targets the configured MACHINE relay', function (): void { + $harness = selfserve_lane_shelly_test_harness(); + + $result = $harness->setMachineRelayStatusHard(true); + + expect($result)->toBeTrue(); + expect($harness->getShellyCallCount('/v2/devices/api/set/switch'))->toBe(1); + expect($harness->shellyCalls[0]['payload'])->toMatchArray([ + 'id' => 'relay-machine', + 'channel' => 0, + 'on' => true, + ]); +}); + it('executes sequential switch requests used by wash start and stop flows', function (): void { $harness = selfserve_lane_shelly_test_harness();