chore: fix e2e shelly mock (#20833)
This commit is contained in:
parent
ef0a12d9a4
commit
f0547b17a3
1 changed files with 7 additions and 4 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue