added support for home assistant postgres database and convenience function to get state of entity
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
"""SQLAlchemy model for the 'statistics' table in the Home Assistant PostgreSQL database."""
|
||||
|
||||
from sqlalchemy import Column, BigInteger, TIMESTAMP, Float, ForeignKey
|
||||
|
||||
from .base import Base
|
||||
|
||||
|
||||
class Statistics(Base):
|
||||
"""SQLAlchemy model for the 'statistics' table."""
|
||||
|
||||
__tablename__ = "statistics"
|
||||
__table_args__ = {"schema": "public"}
|
||||
|
||||
id = Column(BigInteger, primary_key=True, autoincrement=True)
|
||||
created = Column(TIMESTAMP(timezone=True), nullable=True)
|
||||
created_ts = Column(Float, nullable=True)
|
||||
metadata_id = Column(
|
||||
BigInteger, ForeignKey("public.statistics_meta.id", ondelete="CASCADE"), nullable=True
|
||||
)
|
||||
start = Column(TIMESTAMP(timezone=True), nullable=True)
|
||||
start_ts = Column(Float, nullable=True)
|
||||
mean = Column(Float, nullable=True)
|
||||
mean_weight = Column(Float, nullable=True)
|
||||
min = Column(Float, nullable=True)
|
||||
max = Column(Float, nullable=True)
|
||||
last_reset = Column(TIMESTAMP(timezone=True), nullable=True)
|
||||
last_reset_ts = Column(Float, nullable=True)
|
||||
state = Column(Float, nullable=True)
|
||||
sum = Column(Float, nullable=True)
|
||||
Reference in New Issue
Block a user