Added `StepsSensor` entity.

This commit is contained in:
Fabio Manganiello 2023-02-23 00:45:58 +01:00
parent dcab766cef
commit e1b3d52706
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
3 changed files with 32 additions and 0 deletions

View File

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

View File

@ -127,6 +127,14 @@
}
},
"steps_sensor": {
"name": "Sensor",
"name_plural": "Sensors",
"icon": {
"class": "fas fa-shoe-prints"
}
},
"muted": {
"name": "Switch",
"name_plural": "Switches",

View File

@ -0,0 +1,23 @@
from sqlalchemy import Column, Integer, ForeignKey
from platypush.common.db import Base
from .sensors import NumericSensor
if 'steps_sensor' not in Base.metadata:
class StepsSensor(NumericSensor):
"""
A sensor that measures the number of steps taken.
"""
__tablename__ = 'steps_sensor'
id = Column(
Integer, ForeignKey(NumericSensor.id, ondelete='CASCADE'), primary_key=True
)
__mapper_args__ = {
'polymorphic_identity': __tablename__,
}