Wolf480pl on Nostr: The solution seems to be to resample it, with samples aligned to full minutes, before ...
The solution seems to be to resample it, with samples aligned to full minutes, before taking the rate.
This is what I've come up with:
rate((last_over_time(mqtt{topic=~"shellies/.*/relay/.*/energy"}[1m]))[1m:1m])
It's awful, but it seems to work.
3/3
Published at
2025-02-16 18:33:31Event JSON
{
"id": "d27f2265ce5cd0908457bef1cff66d87c5d1a74d032ad90e9117b779aec7fee7",
"pubkey": "f3eaf89270fc0355ce2a91d69bca71c340a0a38b7c833b8ff837e8aaa0c98e82",
"created_at": 1739730811,
"kind": 1,
"tags": [
[
"e",
"ad067bc7afcaae2f8bfbc491b29696335ef1c863dcb3b4963bc64aa27ee7e175",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://mstdn.io/users/wolf480pl/statuses/114014998460627729",
"activitypub"
]
],
"content": "The solution seems to be to resample it, with samples aligned to full minutes, before taking the rate.\n\nThis is what I've come up with:\n\nrate((last_over_time(mqtt{topic=~\"shellies/.*/relay/.*/energy\"}[1m]))[1m:1m])\n\nIt's awful, but it seems to work.\n3/3",
"sig": "b8f02e3bb0e610fd131ab37d4d9eeea36cb6521092a4245d4173bf09a7caed0014142ca575352f85270a034859114fbfe63d2027a6b147a482e8d8065a21505c"
}