Shelly: add usage and caching (BC) (#20570)
This commit is contained in:
parent
e08016f6e9
commit
21b76d5627
15 changed files with 714 additions and 407 deletions
|
|
@ -72,15 +72,12 @@ const teslaloggerMiddleware = (req, res, next) => {
|
|||
};
|
||||
|
||||
const shellyMiddleware = (req, res, next) => {
|
||||
// simulate a shelly gen1 device api. implement power and energy
|
||||
// simulate a shelly gen2 device api. implement power and energy
|
||||
if (req.method === "GET" && req.originalUrl === "/shelly") {
|
||||
res.end(JSON.stringify({ gen: 2 }));
|
||||
} else if (req.originalUrl === "/rpc/Shelly.GetStatus") {
|
||||
res.end(JSON.stringify({ model: "SNSW-001P16EU", gen: 2 }));
|
||||
} else if (req.originalUrl === "/rpc/Switch.GetStatus?id=0") {
|
||||
res.end(
|
||||
JSON.stringify({
|
||||
"switch:0": { 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