From dfb13127eea76e1f8ddaa57eba23ac2db344fb30 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 21 Jan 2023 14:47:18 +0100 Subject: [PATCH] Added MotionSensor entities --- .../panels/Entities/MotionSensor.vue | 1 + .../src/components/panels/Entities/meta.json | 8 ++++++++ platypush/entities/motion.py | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 120000 platypush/backend/http/webapp/src/components/panels/Entities/MotionSensor.vue create mode 100644 platypush/entities/motion.py 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 000000000..70b944608 --- /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 070f39d7b..2406e9bff 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 000000000..05a88eef8 --- /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__, + }