Add optional Home Assistant integration for battery percentage tracking

This commit is contained in:
2026-04-13 20:10:23 -05:00
parent 9d2b1d0d51
commit 8c06478bca
13 changed files with 607 additions and 5 deletions
+2
View File
@@ -12,6 +12,7 @@ class Device(Base):
battery_slots = Column(Integer, nullable=False, default=1)
device_type = Column(String(50), nullable=True)
notes = Column(Text, nullable=True)
ha_entity_id = Column(String(100), nullable=True) # e.g. "sensor.tv_remote_battery"
batteries = relationship("Battery", back_populates="device")
@@ -47,6 +48,7 @@ class Battery(Base):
charge_cycles = Column(Integer, nullable=True) # number of charge cycles
purchase_date = Column(String(10), nullable=True) # YYYY-MM-DD when purchased
storage_location = Column(String(100), nullable=True) # where stored when not installed
battery_percentage = Column(Integer, nullable=True) # current charge %, set by HA poller or manually
device = relationship("Device", back_populates="batteries")
capacity_tests = relationship(