handling of changing ids of sensors
This commit is contained in:
@@ -10,13 +10,15 @@ Base = declarative_base()
|
||||
class Sensor(Base):
|
||||
__tablename__ = 'sensors'
|
||||
id = Column(Integer, primary_key=True)
|
||||
mqtt_name = Column(String(50), unique=True)
|
||||
mqtt_name = Column(String(50)) # Removed unique=True to allow multiple pool sensors with same name
|
||||
mqtt_id = Column(String(50))
|
||||
position = Column(String(50))
|
||||
room = Column(String(50))
|
||||
battery = Column(Float)
|
||||
rain_offset = Column(Float, default=0.0) # Cumulative offset for rain sensor resets
|
||||
last_rain_value = Column(Float, default=0.0) # Last reported rain value (for reset detection)
|
||||
node_id = Column(Integer, nullable=True) # For pool sensors: the nodeId (1, 2, etc.) that generates mqtt_id
|
||||
sensor_type = Column(String(50), nullable=True) # Sensor type: 'BME280', 'DS18B20', 'Bresser-6in1', etc.
|
||||
|
||||
# Define the TemperatureInside table
|
||||
class TemperatureInside(Base):
|
||||
|
||||
Reference in New Issue
Block a user