forked from platypush/platypush
Added StepsSensor
entity.
This commit is contained in:
parent
dcab766cef
commit
e1b3d52706
3 changed files with 32 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
Sensor.vue
|
|
@ -127,6 +127,14 @@
|
|||
}
|
||||
},
|
||||
|
||||
"steps_sensor": {
|
||||
"name": "Sensor",
|
||||
"name_plural": "Sensors",
|
||||
"icon": {
|
||||
"class": "fas fa-shoe-prints"
|
||||
}
|
||||
},
|
||||
|
||||
"muted": {
|
||||
"name": "Switch",
|
||||
"name_plural": "Switches",
|
||||
|
|
23
platypush/entities/steps.py
Normal file
23
platypush/entities/steps.py
Normal 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__,
|
||||
}
|
Loading…
Reference in a new issue