diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/IlluminanceSensor.vue b/platypush/backend/http/webapp/src/components/panels/Entities/IlluminanceSensor.vue new file mode 120000 index 00000000..70b94460 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/IlluminanceSensor.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 b80c9df8..070f39d7 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json +++ b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json @@ -55,6 +55,14 @@ } }, + "illuminance_sensor": { + "name": "Sensor", + "name_plural": "Sensors", + "icon": { + "class": "fas fa-sun" + } + }, + "light": { "name": "Light", "name_plural": "Lights", diff --git a/platypush/entities/illuminance.py b/platypush/entities/illuminance.py new file mode 100644 index 00000000..c9a11e3d --- /dev/null +++ b/platypush/entities/illuminance.py @@ -0,0 +1,22 @@ +from sqlalchemy import Column, Integer, ForeignKey + +from .devices import entity_types_registry +from .sensors import NumericSensor + + +if not entity_types_registry.get('IlluminanceSensor'): + + class IlluminanceSensor(NumericSensor): + __tablename__ = 'illuminance_sensor' + + id = Column( + Integer, ForeignKey(NumericSensor.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + } + + entity_types_registry['IlluminanceSensor'] = IlluminanceSensor +else: + IlluminanceSensor = entity_types_registry['IlluminanceSensor']