Added Alexa Music

This commit is contained in:
2026-07-17 10:12:15 -04:00
parent 92c5268dc8
commit 28a8cb98f6
757 changed files with 151171 additions and 85450 deletions
@@ -1,3 +1,19 @@
# WashData - Home Assistant integration for appliance cycle monitoring via smart plugs.
# Copyright (C) 2026 Lukas Bandura
# SPDX-License-Identifier: AGPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
"""Diagnostic ring buffers for WashData - rolling 24-hour window.
Each WashDataManager owns one DiagBuffer instance that accumulates three
@@ -112,6 +128,12 @@ class DiagBuffer:
"""Record one raw power-sensor reading (call *before* any throttling)."""
self._power.append((ts.timestamp(), watts))
def power_samples(self, since_ts: float | None = None) -> list[tuple[float, float]]:
"""Return raw (unix_ts, watts) readings, optionally only those at/after since_ts."""
if since_ts is None:
return list(self._power)
return [(ts, w) for ts, w in self._power if ts >= since_ts]
def record_state(
self,
from_state: str,