diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/StepsSensor.vue b/platypush/backend/http/webapp/src/components/panels/Entities/StepsSensor.vue new file mode 120000 index 00000000..70b94460 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/StepsSensor.vue @@ -0,0 +1 @@ +Sensor.vue \ No newline at end of file diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json index d5685ac8..6dd10460 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json +++ b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json @@ -127,6 +127,14 @@ } }, + "steps_sensor": { + "name": "Sensor", + "name_plural": "Sensors", + "icon": { + "class": "fas fa-shoe-prints" + } + }, + "muted": { "name": "Switch", "name_plural": "Switches", diff --git a/platypush/entities/steps.py b/platypush/entities/steps.py new file mode 100644 index 00000000..ff536e33 --- /dev/null +++ b/platypush/entities/steps.py @@ -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__, + }