From fd7664208200cbe69e014330d144a3030e20d545 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 22 Jan 2023 21:04:46 +0100 Subject: [PATCH] Added `Volume` and `Muted` entities --- .../src/components/panels/Entities/Muted.vue | 1 + .../src/components/panels/Entities/Volume.vue | 1 + .../src/components/panels/Entities/meta.json | 16 +++++++++ platypush/entities/audio.py | 34 +++++++++++++++++++ 4 files changed, 52 insertions(+) create mode 120000 platypush/backend/http/webapp/src/components/panels/Entities/Muted.vue create mode 120000 platypush/backend/http/webapp/src/components/panels/Entities/Volume.vue create mode 100644 platypush/entities/audio.py diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Muted.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Muted.vue new file mode 120000 index 00000000..e84b54bb --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Muted.vue @@ -0,0 +1 @@ +Switch.vue \ No newline at end of file diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Volume.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Volume.vue new file mode 120000 index 00000000..752ed1e5 --- /dev/null +++ b/platypush/backend/http/webapp/src/components/panels/Entities/Volume.vue @@ -0,0 +1 @@ +Dimmer.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 2406e9bf..d8bc125e 100644 --- a/platypush/backend/http/webapp/src/components/panels/Entities/meta.json +++ b/platypush/backend/http/webapp/src/components/panels/Entities/meta.json @@ -31,6 +31,14 @@ } }, + "volume": { + "name": "Dimmer", + "name_plural": "Dimmers", + "icon": { + "class": "fas fa-volume-high" + } + }, + "dimmer": { "name": "Dimmer", "name_plural": "Dimmers", @@ -103,6 +111,14 @@ } }, + "muted": { + "name": "Switch", + "name_plural": "Switches", + "icon": { + "class": "fas fa-volume-xmark" + } + }, + "enum_switch": { "name": "Switch", "name_plural": "Switches", diff --git a/platypush/entities/audio.py b/platypush/entities/audio.py new file mode 100644 index 00000000..44dae75a --- /dev/null +++ b/platypush/entities/audio.py @@ -0,0 +1,34 @@ +from sqlalchemy import Column, Integer, ForeignKey + +from platypush.common.db import Base + +from .dimmers import Dimmer +from .switches import Switch + + +if 'volume' not in Base.metadata: + + class Volume(Dimmer): + __tablename__ = 'volume' + + id = Column( + Integer, ForeignKey(Dimmer.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + } + + +if 'muted' not in Base.metadata: + + class Muted(Switch): + __tablename__ = 'muted' + + id = Column( + Integer, ForeignKey(Switch.id, ondelete='CASCADE'), primary_key=True + ) + + __mapper_args__ = { + 'polymorphic_identity': __tablename__, + }