Files
python/meshtastic/powermon/sim.py
2024-06-25 11:02:24 -07:00

17 lines
435 B
Python

"""code logging power consumption of meshtastic devices."""
import math
import time
from .power_supply import PowerSupply
class SimPowerSupply(PowerSupply):
"""A simulated power supply for testing."""
def getAverageWatts(self) -> float:
"""Get the total amount of power that is currently being consumed."""
# Sim a 20mW load that varies sinusoidally
return (20 + 5 * math.sin(time.time())) / 1000