From f0547b17a3f142abb892b14a7ee68b16b09fa158 Mon Sep 17 00:00:00 2001 From: Michael Geers Date: Thu, 24 Apr 2025 15:22:06 +0200 Subject: [PATCH] chore: fix e2e shelly mock (#20833) --- tests/simulator/api.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/simulator/api.js b/tests/simulator/api.js index c55e8fed7..ae0fb31de 100644 --- a/tests/simulator/api.js +++ b/tests/simulator/api.js @@ -72,12 +72,15 @@ const teslaloggerMiddleware = (req, res, next) => { }; const shellyMiddleware = (req, res, next) => { - // simulate a shelly gen2 device api. implement power and energy - if (req.method === "GET" && req.originalUrl === "/shelly") { - res.end(JSON.stringify({ model: "SNSW-001P16EU", gen: 2 })); + // simulate a shelly gen2 switch device api. implement power and energy + if (req.originalUrl === "/shelly") { + res.end(JSON.stringify({ gen: 2 })); + } else if (req.originalUrl === "/rpc/Shelly.ListMethods") { + res.end(JSON.stringify({ methods: ["Switch.GetStatus"] })); } else if (req.originalUrl === "/rpc/Switch.GetStatus?id=0") { res.end( - JSON.stringify({ apower: state.site.pv.power, aenergy: { total: state.site.pv.energy } })); + JSON.stringify({ apower: state.site.pv.power, aenergy: { total: state.site.pv.energy } }) + ); } else { next(); }