forked from platypush/platypush
Added support for illuminance sensor entities
This commit is contained in:
parent
03d1c554ea
commit
78c59f437a
3 changed files with 31 additions and 0 deletions
|
@ -0,0 +1 @@
|
||||||
|
Sensor.vue
|
|
@ -55,6 +55,14 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"illuminance_sensor": {
|
||||||
|
"name": "Sensor",
|
||||||
|
"name_plural": "Sensors",
|
||||||
|
"icon": {
|
||||||
|
"class": "fas fa-sun"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
"light": {
|
"light": {
|
||||||
"name": "Light",
|
"name": "Light",
|
||||||
"name_plural": "Lights",
|
"name_plural": "Lights",
|
||||||
|
|
22
platypush/entities/illuminance.py
Normal file
22
platypush/entities/illuminance.py
Normal file
|
@ -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']
|
Loading…
Reference in a new issue