feat: added home assistant widget
This commit is contained in:
@@ -36,6 +36,16 @@ PluginComponent {
|
||||
"y": 0.14,
|
||||
"defaultVisible": true
|
||||
},
|
||||
{
|
||||
"id": "home",
|
||||
"title": "Home",
|
||||
"icon": "home",
|
||||
"width": 420,
|
||||
"height": 420,
|
||||
"x": 0.56,
|
||||
"y": 0.50,
|
||||
"defaultVisible": false
|
||||
},
|
||||
{
|
||||
"id": "system",
|
||||
"title": "Performance",
|
||||
@@ -175,12 +185,42 @@ PluginComponent {
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
function homeToggle(entityId: string) : string {
|
||||
if (!entityId)
|
||||
return "USAGE: homeToggle <entity_id>";
|
||||
|
||||
const domain = haService.domainOf(entityId);
|
||||
if (["scene", "script", "button", "input_button"].indexOf(domain) !== -1)
|
||||
haService.press(entityId);
|
||||
else
|
||||
haService.toggle(entityId);
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
function homeStatus() : string {
|
||||
const picked = Array.isArray(root.pluginData.haEntities) ? root.pluginData.haEntities.length : 0;
|
||||
return "configured=" + haService.configured + " url=" + (haService.baseUrl || "(none)") + " tokenChars=" + haService.token.length + " http=" + haService.lastStatus + " entities=" + haService.entityList.length + " picked=" + picked + " error=" + (haService.lastError || "(none)");
|
||||
}
|
||||
|
||||
function homeRefresh() : string {
|
||||
haService.refresh();
|
||||
return "SUCCESS";
|
||||
}
|
||||
|
||||
function resetLayout() : string {
|
||||
root.resetLayout();
|
||||
return "SUCCESS";
|
||||
}
|
||||
}
|
||||
|
||||
readonly property alias homeService: haService
|
||||
|
||||
GameBarHomeService {
|
||||
id: haService
|
||||
|
||||
daemon: root
|
||||
}
|
||||
|
||||
GameBarOverlay {
|
||||
id: overlay
|
||||
|
||||
|
||||
Reference in New Issue
Block a user