Added distance_sensor entity

This commit is contained in:
Fabio Manganiello 2023-03-31 14:22:28 +02:00
parent 6fb362a6fb
commit 226034946f
3 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1 @@
Sensor.vue

View file

@ -31,6 +31,14 @@
}
},
"distance_sensor": {
"name": "Sensor",
"name_plural": "Sensors",
"icon": {
"class": "fas fa-ruler-horizontal"
}
},
"bluetooth_device": {
"name": "Device",
"name_plural": "Devices",

View file

@ -0,0 +1,23 @@
from sqlalchemy import Column, Integer, ForeignKey
from platypush.common.db import Base
from .sensors import NumericSensor
if 'distance_sensor' not in Base.metadata:
class DistanceSensor(NumericSensor):
"""
This class models distance sensors.
"""
__tablename__ = 'distance_sensor'
id = Column(
Integer, ForeignKey(NumericSensor.id, ondelete='CASCADE'), primary_key=True
)
__mapper_args__ = {
'polymorphic_identity': __tablename__,
}