diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/MotionSensor.vue b/platypush/backend/http/webapp/src/components/panels/Entities/MotionSensor.vue new file mode 120000 index 00000000..70b94460 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/MotionSensor.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 070f39d7..2406e9bf 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json +++ b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json @@ -15,6 +15,14 @@ } }, + "motion_sensor": { + "name": "Sensor", + "name_plural": "Sensors", + "icon": { + "class": "fas fa-person-running" + } + }, + "device": { "name": "Device", "name_plural": "Devices", diff --git a/platypush/entities/motion.py b/platypush/entities/motion.py new file mode 100644 index 00000000..05a88eef --- /dev/null +++ b/platypush/entities/motion.py @@ -0,0 +1,19 @@ +from sqlalchemy import Column, Integer, ForeignKey + +from platypush.common.db import Base + +from .sensors import BinarySensor + + +if 'motion_sensor' not in Base.metadata: + + class MotionSensor(BinarySensor): + __tablename__ = 'motion_sensor' + + id = Column( + Integer, ForeignKey(BinarySensor.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + }