commit
3ddc7ca701
|
@ -1,3 +1,3 @@
|
|||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2b7e5cb00328c9b9d8076a826c368d012628edadf108d078167620945c4742b0
|
||||
size 32849426
|
||||
oid sha256:4ceab794a82c7596f1610c929fc5b14a6b2b835c66ffed7d8db1c8804731c23c
|
||||
size 38613813
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[sub_resource type="BoxShape3D" id="BoxShape3D_3qyo4"]
|
||||
size = Vector3(0.32, 0.16, 0.02)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_h0yvw"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_cw188"]
|
||||
resource_local_to_scene = true
|
||||
render_priority = 10
|
||||
shader = ExtResource("6_40cd1")
|
||||
|
@ -25,7 +25,7 @@ shader_parameter/corner_radius = 0.8
|
|||
shader_parameter/roughness = 0.3
|
||||
shader_parameter/grain_amount = 0.02
|
||||
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_a23j8"]
|
||||
[sub_resource type="QuadMesh" id="QuadMesh_ryeda"]
|
||||
size = Vector2(0.32, 0.16)
|
||||
|
||||
[node name="Timer" type="StaticBody3D" groups=["entity"]]
|
||||
|
@ -78,7 +78,7 @@ label = "stop"
|
|||
icon = true
|
||||
|
||||
[node name="Panel" parent="." instance=ExtResource("5_j3gsb")]
|
||||
material_override = SubResource("ShaderMaterial_h0yvw")
|
||||
mesh = SubResource("QuadMesh_a23j8")
|
||||
material_override = SubResource("ShaderMaterial_cw188")
|
||||
mesh = SubResource("QuadMesh_ryeda")
|
||||
size = Vector2(0.32, 0.16)
|
||||
corner_radius = 0.8
|
||||
|
|
|
@ -10,6 +10,7 @@ const environment_passthrough_material = preload ("res://assets/environment_pass
|
|||
@onready var house = $House
|
||||
@onready var menu = $Menu
|
||||
@onready var keyboard = $Keyboard
|
||||
@onready var xr: XRToolsStartXR = $StartXR
|
||||
var voice_assistant = null
|
||||
|
||||
func _ready():
|
||||
|
@ -67,6 +68,11 @@ func _ready():
|
|||
remove_child(keyboard)
|
||||
)
|
||||
|
||||
xr.xr_started.connect(func():
|
||||
if HomeApi.has_connected() == false:
|
||||
HomeApi.start()
|
||||
)
|
||||
|
||||
func create_voice_assistant():
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
|
|
@ -37,20 +37,22 @@ func _ready():
|
|||
trash_bin_visible = false
|
||||
|
||||
EventSystem.on_grab_down.connect(func(event: EventPointer):
|
||||
trash_bin_visible=event.target is Entity
|
||||
trash_bin_visible=_get_entity(event.target) != null
|
||||
)
|
||||
|
||||
EventSystem.on_grab_move.connect(func(event):
|
||||
if !trash_bin_visible:
|
||||
return
|
||||
|
||||
if event.target is Entity&&area.overlaps_body(event.target):
|
||||
if !to_delete.has(event.target):
|
||||
to_delete.append(event.target)
|
||||
var entity=_get_entity(event.target)
|
||||
|
||||
if entity is Entity&&area.overlaps_body(entity):
|
||||
if !to_delete.has(entity):
|
||||
to_delete.append(entity)
|
||||
trash_bin_large=true
|
||||
|
||||
else:
|
||||
to_delete.erase(event.target)
|
||||
to_delete.erase(entity)
|
||||
trash_bin_large=false
|
||||
|
||||
)
|
||||
|
@ -64,4 +66,15 @@ func _ready():
|
|||
to_delete.clear()
|
||||
trash_bin_large=false
|
||||
trash_bin_visible=false
|
||||
|
||||
House.body.save_all_entities()
|
||||
)
|
||||
|
||||
func _get_entity(node: Node):
|
||||
if node is Entity:
|
||||
return node
|
||||
|
||||
if node.get_parent() == null:
|
||||
return null
|
||||
|
||||
return _get_entity(node.get_parent())
|
|
@ -174,7 +174,7 @@ func create_entity(entity_id: String, entity_position: Vector3, type=null):
|
|||
var room = find_room_at(entity_position)
|
||||
|
||||
if room == null:
|
||||
return null
|
||||
return false
|
||||
|
||||
var entity = EntityFactory.create_entity(entity_id, type)
|
||||
|
||||
|
@ -192,7 +192,7 @@ func create_entity_in(entity_id: String, room_name: String, type=null):
|
|||
var room = find_room(room_name)
|
||||
|
||||
if room == null:
|
||||
return null
|
||||
return false
|
||||
|
||||
var entity = EntityFactory.create_entity(entity_id, type)
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ func _ready():
|
|||
|
||||
if search.value != "":
|
||||
return devices.filter(func(device):
|
||||
var info=device.values()[0]
|
||||
return info["name"].to_lower().find(search.value.to_lower()) != - 1
|
||||
return device["name"].to_lower().find(search.value.to_lower()) != - 1||device["id"].to_lower().find(search.value.to_lower()) != - 1
|
||||
)
|
||||
|
||||
return devices
|
||||
|
@ -47,13 +46,12 @@ func _ready():
|
|||
child.free()
|
||||
|
||||
for device in visible_devices.value:
|
||||
var info=device.values()[0]
|
||||
|
||||
var button_instance=ButtonScene.instantiate()
|
||||
button_instance.label=info["name"]
|
||||
button_instance.label=device["name"]
|
||||
button_instance.font_size=8
|
||||
button_instance.on_button_up.connect(func():
|
||||
on_select_device.emit(device.keys()[0])
|
||||
on_select_device.emit(device["id"])
|
||||
)
|
||||
grid_container.add_child(button_instance)
|
||||
|
||||
|
|
|
@ -21,8 +21,11 @@ func _ready():
|
|||
|
||||
var entity=House.body.create_entity(entity_name, global_position)
|
||||
|
||||
if entity == null:
|
||||
if typeof(entity) == TYPE_BOOL&&entity == false:
|
||||
EventSystem.notify("Entity is not in Room", EventNotify.Type.INFO)
|
||||
|
||||
if entity == null:
|
||||
EventSystem.notify("This Entity is not supported yet", EventNotify.Type.INFO)
|
||||
)
|
||||
|
||||
entities_page.on_back.connect(func():
|
||||
|
|
|
@ -22,13 +22,13 @@ func _ready():
|
|||
var entities=[]
|
||||
|
||||
for device in devices:
|
||||
if device.keys()[0] == selected_device.value:
|
||||
entities=device.values()[0]["entities"]
|
||||
if device["id"] == selected_device.value:
|
||||
entities=device["entities"]
|
||||
break
|
||||
|
||||
if search.value != "":
|
||||
return entities.filter(func(entity):
|
||||
return entity.to_lower().find(search.value.to_lower()) != - 1
|
||||
return entity["name"].to_lower().find(search.value.to_lower()) != - 1||entity["id"].to_lower().find(search.value.to_lower()) != - 1
|
||||
)
|
||||
|
||||
return entities
|
||||
|
@ -61,10 +61,10 @@ func _ready():
|
|||
|
||||
for entity in visible_entities.value:
|
||||
var entity_node=EntityScene.instantiate()
|
||||
entity_node.icon=EntityFactory.get_entity_icon(entity.split(".")[0])
|
||||
entity_node.text=entity
|
||||
entity_node.icon=EntityFactory.get_entity_icon(entity["id"].split(".")[0])
|
||||
entity_node.text=entity["name"]
|
||||
entity_node.on_select.connect(func():
|
||||
on_select_entity.emit(entity)
|
||||
on_select_entity.emit(entity["id"])
|
||||
)
|
||||
entity_container.add_child(entity_node)
|
||||
|
||||
|
|
35
app/content/ui/menu/settings/menus/api_menu.gd
Normal file
35
app/content/ui/menu/settings/menus/api_menu.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var status_label = $LabelStatus
|
||||
@onready var input_url = $InputURL
|
||||
@onready var input_token = $InputToken
|
||||
@onready var button_connect = $Connect
|
||||
|
||||
func _ready():
|
||||
var settings_store = Store.settings.state
|
||||
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
input_url.text = settings_store.url
|
||||
input_token.text = settings_store.token
|
||||
|
||||
button_connect.on_button_down.connect(func():
|
||||
var url=input_url.text
|
||||
var token=input_token.text
|
||||
|
||||
HomeApi.start_adapter("hass_ws", url, token)
|
||||
|
||||
settings_store.url=url
|
||||
settings_store.token=token
|
||||
|
||||
Store.settings.save_local()
|
||||
)
|
||||
|
||||
HomeApi.on_connect.connect(func():
|
||||
status_label.text="Status: Connected"
|
||||
)
|
||||
|
||||
HomeApi.on_disconnect.connect(func():
|
||||
status_label.text="Status: Disconnected"
|
||||
)
|
64
app/content/ui/menu/settings/menus/api_menu.tscn
Normal file
64
app/content/ui/menu/settings/menus/api_menu.tscn
Normal file
|
@ -0,0 +1,64 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cdto8shis71nu"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="1_01lhk"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/settings/menus/api_menu.gd" id="1_uatcf"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="2_kmvrs"]
|
||||
|
||||
[node name="ApiMenu" type="Node3D"]
|
||||
script = ExtResource("1_uatcf")
|
||||
|
||||
[node name="LabelURL" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.08, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Url:
|
||||
"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputURL" parent="." instance=ExtResource("1_01lhk")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, -0.08, 0)
|
||||
text = "ws://192.168.0.1:8123"
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelToken" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.12, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Token:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputToken" parent="." instance=ExtResource("1_01lhk")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, -0.12, 0)
|
||||
text = "..."
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelConnect" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.17, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Connect:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Connect" parent="." instance=ExtResource("2_kmvrs")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.13, -0.17, 0)
|
||||
label = "login"
|
||||
icon = true
|
||||
|
||||
[node name="LabelStatus" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.22, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Status: Disconnected"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
39
app/content/ui/menu/settings/menus/features_menu.gd
Normal file
39
app/content/ui/menu/settings/menus/features_menu.gd
Normal file
|
@ -0,0 +1,39 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var voice_assist = $VoiceAssist
|
||||
|
||||
func _ready():
|
||||
var settings_store = Store.settings.state
|
||||
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
var button_label = R.computed(func(_arg):
|
||||
return "mic_off" if settings_store.voice_assistant == false else "mic"
|
||||
)
|
||||
|
||||
voice_assist.on_button_down.connect(func():
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
OS.request_permissions()
|
||||
|
||||
voice_assist.label="mic"
|
||||
|
||||
settings_store.voice_assistant=true
|
||||
Store.settings.save_local()
|
||||
)
|
||||
|
||||
voice_assist.on_button_up.connect(func():
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
voice_assist.label="mic_off"
|
||||
|
||||
settings_store.voice_assistant=false
|
||||
Store.settings.save_local()
|
||||
|
||||
)
|
||||
|
||||
R.bind(voice_assist, "label", button_label)
|
||||
R.bind(voice_assist, "active", settings_store, "voice_assistant")
|
23
app/content/ui/menu/settings/menus/features_menu.tscn
Normal file
23
app/content/ui/menu/settings/menus/features_menu.tscn
Normal file
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://4hai6lp64m2o"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_52ufi"]
|
||||
[ext_resource type="Script" path="res://content/ui/menu/settings/menus/features_menu.gd" id="1_imqs2"]
|
||||
|
||||
[node name="FeaturesMenu" type="Node3D"]
|
||||
script = ExtResource("1_imqs2")
|
||||
|
||||
[node name="VoiceAssist" parent="." instance=ExtResource("1_52ufi")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.19, -0.08, 0)
|
||||
label = "mic_off"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="LabelVoiceAssist" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.08, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Voice Assistant: "
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
16
app/content/ui/menu/settings/menus/save_menu.gd
Normal file
16
app/content/ui/menu/settings/menus/save_menu.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
extends Node3D
|
||||
|
||||
@onready var save = $Save
|
||||
@onready var clear_save = $ClearSave
|
||||
|
||||
func _ready():
|
||||
|
||||
save.on_button_down.connect(func():
|
||||
House.body.save_all_entities()
|
||||
Store.house.save_local()
|
||||
)
|
||||
|
||||
clear_save.on_button_down.connect(func():
|
||||
Store.house.clear()
|
||||
House.body.update_house()
|
||||
)
|
50
app/content/ui/menu/settings/menus/save_menu.tscn
Normal file
50
app/content/ui/menu/settings/menus/save_menu.tscn
Normal file
|
@ -0,0 +1,50 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://cxom4iapa02bb"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/settings/menus/save_menu.gd" id="1_7j7hb"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_y2t0y"]
|
||||
|
||||
[node name="SaveMenu" type="Node3D"]
|
||||
script = ExtResource("1_7j7hb")
|
||||
|
||||
[node name="SaveLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.08, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Manual Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Save" parent="." instance=ExtResource("1_y2t0y")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.08, 0)
|
||||
label = "save"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveLabel" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.13, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Clear Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="ClearSave" parent="." instance=ExtResource("1_y2t0y")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.14, 0)
|
||||
label = "close"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveWarning" type="Label3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.15, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
text = "Caution! This will delete all your rooms and placed devices."
|
||||
font_size = 8
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
autowrap_mode = 3
|
||||
width = 150.0
|
|
@ -1,104 +1,14 @@
|
|||
extends Node3D
|
||||
|
||||
const credits_scene = preload ("./credits.tscn")
|
||||
|
||||
@onready var connection_status = $Content/ConnectionStatus
|
||||
|
||||
@onready var input_url = $Content/InputURL
|
||||
@onready var input_token = $Content/InputToken
|
||||
@onready var button_connect = $Content/Connect
|
||||
@onready var credits = $Content/Credits/Clickable
|
||||
@onready var save = $Content/Save
|
||||
@onready var clear_save = $Content/ClearSave
|
||||
@onready var background = $Background
|
||||
@onready var voice_assist = $Content/VoiceAssist
|
||||
@onready var version_label = $Content/LabelVersion
|
||||
|
||||
func _ready():
|
||||
_load_game_version()
|
||||
var settings_store = Store.settings.state
|
||||
|
||||
background.visible = false
|
||||
|
||||
credits.on_click.connect(func(_event):
|
||||
var credits_instance=credits_scene.instantiate()
|
||||
get_tree().root.add_child(credits_instance)
|
||||
var label=$Content/Credits/Label
|
||||
credits_instance.global_position=+ label.to_global(label.position + Vector3(0.1, 0, -0.15))
|
||||
)
|
||||
|
||||
if Store.settings.is_loaded():
|
||||
input_url.text = settings_store.url
|
||||
input_token.text = settings_store.token
|
||||
else:
|
||||
Store.settings.on_loaded.connect(func():
|
||||
input_url.text=settings_store.url
|
||||
input_token.text=settings_store.token
|
||||
)
|
||||
|
||||
button_connect.on_button_down.connect(func():
|
||||
var url=input_url.text
|
||||
var token=input_token.text
|
||||
|
||||
HomeApi.start_adapter("hass_ws", url, token)
|
||||
|
||||
settings_store.url=url
|
||||
settings_store.token=token
|
||||
|
||||
Store.settings.save_local()
|
||||
)
|
||||
|
||||
save.on_button_down.connect(func():
|
||||
House.body.save_all_entities()
|
||||
Store.house.save_local()
|
||||
)
|
||||
|
||||
clear_save.on_button_down.connect(func():
|
||||
Store.house.clear()
|
||||
House.body.update_house()
|
||||
)
|
||||
|
||||
voice_assist.on_button_down.connect(func():
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
OS.request_permissions()
|
||||
|
||||
voice_assist.label="mic"
|
||||
|
||||
settings_store.voice_assistant=true
|
||||
Store.settings.save_local()
|
||||
)
|
||||
|
||||
voice_assist.on_button_up.connect(func():
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
voice_assist.label="mic_off"
|
||||
|
||||
settings_store.voice_assistant=false
|
||||
Store.settings.save_local()
|
||||
|
||||
)
|
||||
|
||||
HomeApi.on_connect.connect(func():
|
||||
connection_status.text="Connected"
|
||||
)
|
||||
|
||||
HomeApi.on_disconnect.connect(func():
|
||||
connection_status.text="Disconnected"
|
||||
)
|
||||
|
||||
if Store.settings.is_loaded() == false:
|
||||
await Store.settings.on_loaded
|
||||
|
||||
var button_label = R.computed(func(_arg):
|
||||
return "mic_off" if settings_store.voice_assistant == false else "mic"
|
||||
)
|
||||
|
||||
R.bind(voice_assist, "label", button_label)
|
||||
R.bind(voice_assist, "active", settings_store, "voice_assistant")
|
||||
|
||||
func _load_game_version():
|
||||
var presets = ConfigFile.new()
|
||||
presets.load("res://export_presets.cfg")
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://c6r4higceibif"]
|
||||
[gd_scene load_steps=14 format=3 uid="uid://c6r4higceibif"]
|
||||
|
||||
[ext_resource type="Script" path="res://content/ui/menu/settings/settings_menu.gd" id="1_0lte6"]
|
||||
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_faxng"]
|
||||
[ext_resource type="Script" path="res://content/functions/clickable.gd" id="3_qmg6q"]
|
||||
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_q3x6k"]
|
||||
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="5_eiwd4"]
|
||||
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="6_mubnp"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/tabs/tabs.gd" id="7_oydon"]
|
||||
[ext_resource type="Script" path="res://content/ui/components/tabs/tabs_content.gd" id="8_ctbdo"]
|
||||
[ext_resource type="PackedScene" uid="uid://cdto8shis71nu" path="res://content/ui/menu/settings/menus/api_menu.tscn" id="8_jicvf"]
|
||||
[ext_resource type="PackedScene" uid="uid://4hai6lp64m2o" path="res://content/ui/menu/settings/menus/features_menu.tscn" id="9_k7004"]
|
||||
[ext_resource type="PackedScene" uid="uid://cxom4iapa02bb" path="res://content/ui/menu/settings/menus/save_menu.tscn" id="10_5aa3y"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_3qdps"]
|
||||
size = Vector3(0.07, 0.02, 0.01)
|
||||
|
@ -31,62 +35,6 @@ size = Vector2(0.42, 0.32)
|
|||
script = ExtResource("1_0lte6")
|
||||
|
||||
[node name="Content" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.007, 0)
|
||||
|
||||
[node name="ConnectionStatus" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.251, -0.151, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Disconnected"
|
||||
font_size = 8
|
||||
outline_size = 0
|
||||
|
||||
[node name="LabelURL" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.03, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "url:
|
||||
"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputURL" parent="Content" instance=ExtResource("4_q3x6k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.03, 0)
|
||||
text = "ws://192.168.0.1:8123"
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelToken" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.07, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "token:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="InputToken" parent="Content" instance=ExtResource("4_q3x6k")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, -0.07, 0)
|
||||
text = "..."
|
||||
size = Vector3(0.2, 0.03, 0.01)
|
||||
|
||||
[node name="LabelConnect" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.14, -0.12, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Connect"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Connect" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.12, 0)
|
||||
label = "login"
|
||||
icon = true
|
||||
|
||||
[node name="Credits" type="StaticBody3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.37, -0.300229, 0)
|
||||
|
@ -120,66 +68,6 @@ outline_size = 0
|
|||
[node name="Clickable" type="Node" parent="Content/Credits"]
|
||||
script = ExtResource("3_qmg6q")
|
||||
|
||||
[node name="SaveLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.21, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Manual Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="Save" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, -0.21, 0)
|
||||
label = "save"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveLabel" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.26, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Clear Save:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="ClearSave" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, -0.27, 0)
|
||||
label = "close"
|
||||
icon = true
|
||||
|
||||
[node name="clearSaveWarning" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.28, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
modulate = Color(1, 0, 0, 1)
|
||||
text = "Caution! This will delete all your rooms and placed devices."
|
||||
font_size = 8
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
autowrap_mode = 3
|
||||
width = 150.0
|
||||
|
||||
[node name="VoiceAssist" parent="Content" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1, -0.12, 0)
|
||||
label = "mic_off"
|
||||
icon = true
|
||||
toggleable = true
|
||||
|
||||
[node name="LabelVoiceAssist" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.12, 0)
|
||||
pixel_size = 0.001
|
||||
render_priority = 15
|
||||
outline_render_priority = 14
|
||||
text = "Voice-
|
||||
Assist:"
|
||||
font_size = 18
|
||||
outline_size = 0
|
||||
horizontal_alignment = 0
|
||||
|
||||
[node name="LabelVersion" type="Label3D" parent="Content"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.41, -0.31, 0)
|
||||
pixel_size = 0.001
|
||||
|
@ -195,3 +83,38 @@ transform = Transform3D(1, 0, 0, 0, 1, 1.06581e-14, 0, -1.06581e-14, 1, 0.21, -0
|
|||
material_override = SubResource("ShaderMaterial_3iv64")
|
||||
mesh = SubResource("QuadMesh_d0l0p")
|
||||
skeleton = NodePath("../..")
|
||||
|
||||
[node name="Tabs" type="Node3D" parent="." node_paths=PackedStringArray("initial_selected")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.01, -0.03, 0)
|
||||
script = ExtResource("7_oydon")
|
||||
initial_selected = NodePath("Api")
|
||||
gap = 0.01
|
||||
|
||||
[node name="Api" parent="Tabs" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, 0, 0)
|
||||
font_size = 18
|
||||
label = "Api"
|
||||
|
||||
[node name="Features" parent="Tabs" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.095, 0, 0)
|
||||
font_size = 18
|
||||
label = "Features"
|
||||
size = Vector3(0.09, 0.04, 0.01)
|
||||
|
||||
[node name="Save" parent="Tabs" instance=ExtResource("1_faxng")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18, 0, 0)
|
||||
font_size = 18
|
||||
label = "Other"
|
||||
size = Vector3(0.06, 0.04, 0.01)
|
||||
|
||||
[node name="TabsContent3D" type="Node3D" parent="." node_paths=PackedStringArray("tabs")]
|
||||
script = ExtResource("8_ctbdo")
|
||||
tabs = NodePath("../Tabs")
|
||||
|
||||
[node name="ApiMenu" parent="TabsContent3D" instance=ExtResource("8_jicvf")]
|
||||
|
||||
[node name="FeaturesMenu" parent="TabsContent3D" instance=ExtResource("9_k7004")]
|
||||
visible = false
|
||||
|
||||
[node name="SaveMenu" parent="TabsContent3D" instance=ExtResource("10_5aa3y")]
|
||||
visible = false
|
||||
|
|
|
@ -29,10 +29,25 @@ signal on_disconnect()
|
|||
|
||||
## The current home automation system adapter
|
||||
var api: Node
|
||||
var reconnect_timer := Timer.new()
|
||||
|
||||
func _ready():
|
||||
print("HomeApi ready")
|
||||
start()
|
||||
|
||||
reconnect_timer.wait_time = 60
|
||||
reconnect_timer.one_shot = false
|
||||
reconnect_timer.autostart = true
|
||||
|
||||
add_child(reconnect_timer)
|
||||
|
||||
reconnect_timer.timeout.connect(func():
|
||||
if has_connected() == false:
|
||||
start()
|
||||
)
|
||||
|
||||
## Starts the adapter with the settings from the settings file
|
||||
func start():
|
||||
var success = Store.settings.load_local()
|
||||
|
||||
if success:
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
{% set devices = states | map(attribute='entity_id') | map('device_id') | unique | reject('eq',None) | list %}
|
||||
|
||||
{%- set ns = namespace(devices = []) %}
|
||||
{%- set ns = namespace(devices = [], entities = []) %}
|
||||
{%- for device in devices %}
|
||||
{%- set entities = device_entities(device) | list %}
|
||||
{%- set ns.entities = [] %}
|
||||
{%- if entities %}
|
||||
{%- set ns.devices = ns.devices + [ {device: {"name": device_attr(device, "name"), "entities": entities }} ] %}
|
||||
{%- for entity in entities %}
|
||||
{%- set ns.entities = ns.entities + [ {"id": entity, "name": state_attr(entity, "friendly_name")} ] %}
|
||||
{%- endfor %}
|
||||
{%- set ns.devices = ns.devices + [{"id": device, "name": device_attr(device, "name"), "entities": ns.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] %}
|
||||
{%- set ns_group.entities = ns_group.entities + [{"id": state.entity_id, "name": state.entity_id}] %}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- set ns.devices = ns.devices + [ {"other": {"name": "Other", "entities": ns_group.entities }} ] %}
|
||||
{%- set ns.devices = ns.devices + [ {"id": "other.other", "name": "Other", "entities": ns_group.entities } ] %}
|
||||
|
||||
{{ ns.devices }}
|
|
@ -10,12 +10,19 @@ func _init():
|
|||
var devices=await HomeApi.get_devices()
|
||||
|
||||
devices.sort_custom(func(a, b):
|
||||
return a.values()[0]["name"].to_lower() < b.values()[0]["name"].to_lower()
|
||||
return a["name"].to_lower() < b["name"].to_lower()
|
||||
)
|
||||
|
||||
for device in devices:
|
||||
device.values()[0]["entities"].sort_custom(func(a, b):
|
||||
return a.to_lower() < b.to_lower()
|
||||
if device["name"] == null:
|
||||
device["name"]=device["id"]
|
||||
|
||||
for entity in device["entities"]:
|
||||
if entity["name"] == null:
|
||||
entity["name"]=entity["id"]
|
||||
|
||||
device["entities"].sort_custom(func(a, b):
|
||||
return a["name"].to_lower() < b["name"].to_lower()
|
||||
)
|
||||
|
||||
self.state.devices=devices
|
||||
|
|
Loading…
Reference in New Issue
Block a user