forked from platypush/platypush
Fabio Manganiello
64513be6b8
Implemented (at least in `zigbee.mqtt`, for now): - `TemperatureSensor` - `HumiditySensor` - `VoltageSensor` - `CurrentSensor` - `EnergySensor` - `PowerSensor` - `NumericSensor` (generic fallback 1) - `RawSensor` (generic fallback 2) - `Sensor` (root class)
22 lines
607 B
Python
22 lines
607 B
Python
from sqlalchemy import Column, Integer, ForeignKey
|
|
|
|
from .devices import entity_types_registry
|
|
from .sensors import NumericSensor
|
|
|
|
|
|
if not entity_types_registry.get('HumiditySensor'):
|
|
|
|
class HumiditySensor(NumericSensor):
|
|
__tablename__ = 'humidity_sensor'
|
|
|
|
id = Column(
|
|
Integer, ForeignKey(NumericSensor.id, ondelete='CASCADE'), primary_key=True
|
|
)
|
|
|
|
__mapper_args__ = {
|
|
'polymorphic_identity': __tablename__,
|
|
}
|
|
|
|
entity_types_registry['HumiditySensor'] = HumiditySensor
|
|
else:
|
|
HumiditySensor = entity_types_registry['HumiditySensor']
|