From 81a26a140a178b9138ed48cb88de78bba1f9abc9 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Sat, 9 Dec 2023 22:50:23 +0100 Subject: [PATCH] Add deviceless entities --- content/entities/switch/switch.tscn | 4 ++-- content/system/room/room.tscn | 2 +- lib/home_apis/hass_ws/templates/devices.j2 | 11 ++++++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/content/entities/switch/switch.tscn b/content/entities/switch/switch.tscn index 73188c6..e0e0589 100644 --- a/content/entities/switch/switch.tscn +++ b/content/entities/switch/switch.tscn @@ -7,7 +7,7 @@ [ext_resource type="Script" path="res://content/functions/occludable.gd" id="5_j5ucu"] [sub_resource type="SphereShape3D" id="SphereShape3D_ukj14"] -radius = 0.1 +radius = 0.0482081 [sub_resource type="SpriteFrames" id="SpriteFrames_ldpuo"] animations = [{ @@ -31,7 +31,7 @@ script = ExtResource("1_8ffhi") shape = SubResource("SphereShape3D_ukj14") [node name="Icon" type="AnimatedSprite3D" parent="."] -pixel_size = 0.0005 +pixel_size = 0.0002 billboard = 1 sprite_frames = SubResource("SpriteFrames_ldpuo") diff --git a/content/system/room/room.tscn b/content/system/room/room.tscn index 8cc9291..5ac8428 100644 --- a/content/system/room/room.tscn +++ b/content/system/room/room.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" path="res://content/system/room/room.gd" id="1_fccq0"] [ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"] -[ext_resource type="Material" path="res://content/system/room/walls.tres" id="3_al1ev"] +[ext_resource type="Material" uid="uid://bbx6fv7jq50tr" path="res://content/system/room/walls.tres" id="3_al1ev"] [sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_08sv0"] diff --git a/lib/home_apis/hass_ws/templates/devices.j2 b/lib/home_apis/hass_ws/templates/devices.j2 index 40b05f7..6f27c89 100644 --- a/lib/home_apis/hass_ws/templates/devices.j2 +++ b/lib/home_apis/hass_ws/templates/devices.j2 @@ -1,5 +1,5 @@ {% set devices = states | map(attribute='entity_id') | map('device_id') | unique | reject('eq',None) | list %} - + {%- set ns = namespace(devices = []) %} {%- for device in devices %} {%- set entities = device_entities(device) | list %} @@ -7,4 +7,13 @@ {%- set ns.devices = ns.devices + [ {device: {"name": device_attr(device, "name"), "entities": entities }} ] %} {%- endif %} {%- endfor %} + +{%- set ns_group = namespace(entities = []) %} +{%- for state in states %} + {%- if device_id(state.entity_id) == None %} + {%- set ns_group.entities = ns_group.entities + [state.entity_id] %} + {%- endif %} +{%- endfor %} +{%- set ns.devices = ns.devices + [ {"other": {"name": "Other", "entities": ns_group.entities }} ] %} + {{ ns.devices }} \ No newline at end of file