├── .github
└── FUNDING.yml
├── HomeAssistantPlugin
├── src
│ ├── Directory.Build.props
│ ├── HomeAssistantPlugin
│ │ ├── metadata
│ │ │ ├── Icon16x16.png
│ │ │ ├── Icon256x256.png
│ │ │ ├── Icon32x32.png
│ │ │ ├── Icon48x48.png
│ │ │ └── LoupedeckPackage.yaml
│ │ ├── Resources
│ │ │ └── ButtonBaseHomeAssistant.png
│ │ ├── BuildEvents
│ │ │ ├── postbuild
│ │ │ └── postbuild.cmd
│ │ ├── packages.config
│ │ ├── HomeAssistantApplication.cs
│ │ ├── Properties
│ │ │ ├── AssemblyInfo.cs
│ │ │ ├── Resources.Designer.cs
│ │ │ └── Resources.resx
│ │ ├── App.config
│ │ ├── HomeAssistantPlugin.cs
│ │ ├── Actions
│ │ │ ├── HomeAssistantServiceComand.cs
│ │ │ ├── _HomeAssistantStateCommand.cs
│ │ │ ├── HomeAssistantTemplateCommand.cs
│ │ │ └── HomeAssistantStateCommand.cs
│ │ └── HomeAssistantPlugin.csproj
│ ├── HomeAssistantPlugin.sln
│ └── .editorconfig
└── .gitignore
├── LICENSE
└── README.md
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | custom: ["https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU"]
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | 7.3
4 |
5 |
6 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon16x16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lubeda/Loupedeck-HomeAssistantPlugin/HEAD/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon16x16.png
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon256x256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lubeda/Loupedeck-HomeAssistantPlugin/HEAD/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon256x256.png
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon32x32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lubeda/Loupedeck-HomeAssistantPlugin/HEAD/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon32x32.png
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon48x48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lubeda/Loupedeck-HomeAssistantPlugin/HEAD/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/Icon48x48.png
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Resources/ButtonBaseHomeAssistant.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lubeda/Loupedeck-HomeAssistantPlugin/HEAD/HomeAssistantPlugin/src/HomeAssistantPlugin/Resources/ButtonBaseHomeAssistant.png
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/BuildEvents/postbuild:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Project post-build event for macOS
4 |
5 | PROJECT_DIR=$1
6 | TARGET_DIR=$2
7 |
8 | assert() {
9 | if eval $1 ; then
10 | echo "$0: Error: $2"
11 | exit 1
12 | fi
13 | }
14 |
15 | assert "[ -z \"$PROJECT_DIR\" ]" "Project directory was not given"
16 | assert "[ -z \"$TARGET_DIR\" ]" "Target directory was not given"
17 | assert "[ ! -d \"$TARGET_DIR\" ]" "Target directory does not exist: '$TARGET_DIR'"
18 |
19 | METADATA_DIR=${PROJECT_DIR}metadata
20 | assert "[ ! -d \"$METADATA_DIR\" ]" "metadata directory does not exist: '$METADATA_DIR'"
21 |
22 | echo Copying "$METADATA_DIR" to "${TARGET_DIR}../metadata"
23 | cp -R "$METADATA_DIR" "${TARGET_DIR}../metadata"
24 | assert "[ $? -ne 0 ]" "Copying metadata failed"
25 |
26 | exit 0
27 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/BuildEvents/postbuild.cmd:
--------------------------------------------------------------------------------
1 | @echo off
2 |
3 | :: Project post-build event for Windows
4 |
5 | set PROJECT_DIR=%~1
6 | set TARGET_DIR=%~2
7 |
8 | if "%PROJECT_DIR%" == "" (
9 | echo %~0: Error: Project directory was not given
10 | exit /b 1
11 | )
12 |
13 | if "%TARGET_DIR%" == "" (
14 | echo %~0: Error: Target directory was not given
15 | exit /b 1
16 | )
17 |
18 | if not exist "%TARGET_DIR%" (
19 | echo %~0: Error: Target directory does not exist: '%TARGET_DIR%'"
20 | exit /b 1
21 | )
22 |
23 | set METADATA_DIR=%PROJECT_DIR%metadata\
24 |
25 | if not exist "%METADATA_DIR%" (
26 | echo %~0: "Error: metadata directory does not exist: '%METADATA_DIR%'"
27 | exit /b 1
28 | )
29 |
30 | echo Copying "%METADATA_DIR%" to "%TARGET_DIR%..\metadata\"
31 | xcopy /s /y "%METADATA_DIR%" "%TARGET_DIR%..\metadata\"
32 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/HomeAssistantApplication.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeAssistantPlugin
2 | {
3 | using System;
4 |
5 | // This class can be used to connect the Loupedeck plugin to an application.
6 |
7 | public class HomeAssistantApplication : ClientApplication
8 | {
9 | public HomeAssistantApplication()
10 | {
11 | }
12 |
13 | // This method can be used to link the plugin to a Windows application.
14 | protected override String GetProcessName() => "";
15 |
16 | // This method can be used to link the plugin to a macOS application.
17 | protected override String GetBundleName() => "";
18 |
19 | // This method can be used to check whether the application is installed or not.
20 | public override ClientApplicationStatus GetApplicationStatus() => ClientApplicationStatus.Unknown;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 LuBeDa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30128.74
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HomeAssistantPlugin", "HomeAssistantPlugin\HomeAssistantPlugin.csproj", "{D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {22481377-D382-4988-838B-A5455C09443E}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("HomeAssistant plugin for Loupedeck")]
9 | [assembly: AssemblyDescription("Control your Home")]
10 | [assembly: AssemblyConfiguration("See githubpage for information.")]
11 | [assembly: AssemblyCompany("lubeda")]
12 | [assembly: AssemblyProduct("Loupedeck2")]
13 | [assembly: AssemblyCopyright("MIT")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("5.3.1.14222")]
35 | [assembly: AssemblyVersion("5.3.1.14222")]
36 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/HomeAssistantPlugin.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeAssistantPlugin
2 | {
3 | using System;
4 | using System.IO;
5 |
6 | // This class contains the plugin-level logic of the Loupedeck plugin.
7 |
8 | public class HomeAssistantPlugin : Plugin
9 | {
10 | // Gets a value indicating whether this is an Universal plugin or an Application plugin.
11 | public override Boolean UsesApplicationApiOnly => true;
12 |
13 | // Gets a value indicating whether this is an API-only plugin.
14 | public override Boolean HasNoApplication => true;
15 |
16 | internal static readonly String DEFAULT_PATH = Path.Combine(".loupedeck", "homeassistant");
17 | internal static String UserProfilePath => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
18 | public String ConfigFile;
19 |
20 | public class HAServiceEntry
21 | {
22 | public String Service;
23 | public String[] Entities;
24 | }
25 | public class HAAPIConfig
26 | {
27 | public String Url;
28 | public String Token;
29 |
30 | public HAServiceEntry[] Entries;
31 | public String[] States;
32 | }
33 |
34 | internal static HAAPIConfig Config;
35 |
36 | public override void Load()
37 | {
38 | this.Init();
39 | Config = IoHelpers.EnsureFileDirectoryExists(this.ConfigFile)
40 | ? JsonHelpers.DeserializeAnyObjectFromFile(this.ConfigFile)
41 | : null;
42 | }
43 | // This method is called when the plugin is unloaded during the Loupedeck service shutdown.
44 | public override void Unload()
45 | {
46 | }
47 |
48 | private void Init()
49 | {
50 | if (!Directory.Exists(Path.Combine(UserProfilePath, DEFAULT_PATH)))
51 | {
52 | Directory.CreateDirectory(Path.Combine(UserProfilePath, DEFAULT_PATH));
53 | }
54 | var fp = Path.Combine(UserProfilePath, DEFAULT_PATH);
55 | this.ConfigFile = fp + "\\homeassistant.json";
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 1. Table of content
2 | - [1. Table of content](#1-table-of-content)
3 | - [2. What is this Plugin?](#2-what-is-this-plugin)
4 | - [3. Setup](#3-setup)
5 | - [4. How to use it?](#5-how-to-use-it)
6 | - [5. Support / Feedback](#4-support--feedback)
7 | - [6. How to contribute?](#6-how-to-contribute)
8 | - [7. Sponsor me!](#7-how-to-sponsor)
9 |
10 | # 2. What is this Plugin?
11 | This Loupedeck Plugin allows you to control your home with [HomeAssistant](https://homeassistant.io)
12 |
13 | It is in a very basic state. You can only call services that need no parameters.
14 | There is only a windows version of it.
15 | The code is really hacky, there are no plausibiliy controls etc. so expect crashing the loupedesk exe.
16 |
17 | Take a look here [https://github.com/schmic/Loupedeck-HomeAssistant](https://github.com/schmic/Loupedeck-HomeAssistant) for a websocket bases solution under active development.
18 |
19 | # 3. Setup
20 | Install (if available) a binary release of the plugin.
21 |
22 | create a homeassistant.json like this
23 | ```json
24 | {
25 | "token": "YourLongLivedToken",
26 | "url": "http://homeassistant.local:8123/api/",
27 | "entries": [
28 | {
29 | "service": "light.turn_on",
30 | "entities": [
31 | "light.light_1",
32 | "light.light_2",
33 | "light.light_4"
34 | ]
35 | },
36 | {
37 | "service": "switch.toggle",
38 | "entities": [
39 | "switch.plug_1",
40 | "switch.cover_3",
41 | "switch.light_65"
42 | ]
43 | }
44 | ]
45 | }
46 | ```
47 | replace the fields with your values.
48 |
49 | place the file in `%userprofile%\.loupedeck\homeassistant\` as `homeassistant.json`
50 |
51 | # 4. How to use it?
52 |
53 | 1. Install the Plugin
54 | 2. Create a config
55 | 3. Add Actions to Loupedeck
56 | 4. Have fun controlling your home
57 |
58 | As addition see this video [youtube](https://youtu.be/9kJEw0r1UN4) or the discussion in the home assistant [community](https://community.home-assistant.io/t/use-a-loupedeck-as-a-panel-for-homeassistant/486240)
59 |
60 | # 5. Support / Feedback
61 | You found a bug? You have a feature request? I would love to hear about it [here](https://github.com/lubeda/Loupedeck-HomeAssistantPlugin/issues/new/choose) or click on the "Issues" tab here on the GitHub repositorie!
62 |
63 | # 6. How to contribute?
64 |
65 | Just fork the repository and create PR's.
66 |
67 | # 7 How to sponsor?
68 |
69 | [Paypal](https://www.paypal.com/donate/?hosted_button_id=FZDKSLQ46HJTU)
70 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Actions/HomeAssistantServiceComand.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeassistantPlugin
2 | {
3 | using System;
4 | using System.Net.Http;
5 | using System.Net.Http.Headers;
6 |
7 | public class HomeAssistandCommand : PluginDynamicCommand
8 | {
9 | public HomeAssistandCommand() : base("Call Service", "Controll your Home", "Entity")
10 | {
11 | this.MakeProfileAction("tree");
12 | }
13 | protected override PluginProfileActionData GetProfileActionData()
14 | {
15 | var tree = new PluginProfileActionTree("Select Service and entity");
16 | tree.AddLevel("Service");
17 | tree.AddLevel("Entity");
18 | if (HomeAssistantPlugin.HomeAssistantPlugin.Config != null)
19 | {
20 | if (HomeAssistantPlugin.HomeAssistantPlugin.Config.Entries.Length > 0)
21 | {
22 | foreach (HomeAssistantPlugin.HomeAssistantPlugin.HAServiceEntry e in HomeAssistantPlugin.HomeAssistantPlugin.Config.Entries)
23 | {
24 | PluginProfileActionTreeNode pluginProfileActionTreeNode = tree.Root.AddNode(e.Service);
25 | foreach (String s in e.Entities)
26 | {
27 | pluginProfileActionTreeNode.SetPropertyValue("Service", e.Service);
28 | pluginProfileActionTreeNode.AddItem(e.Service + "|" + s, s, e.Service);
29 | }
30 | }
31 | }
32 | }
33 | return tree;
34 | }
35 |
36 | protected override String GetCommandDisplayName(String actionParameter, PluginImageSize imageSize) => String.IsNullOrEmpty(actionParameter) ? "HomeAssistant" : actionParameter;
37 |
38 |
39 | protected override void RunCommand(String actionParameter)
40 | {
41 | if (actionParameter.Contains("|"))
42 | {
43 | var service = actionParameter.Split("|")[0];
44 | var entity = actionParameter.Split("|")[1];
45 | var _client = new HttpClient();
46 | var url = HomeAssistantPlugin.HomeAssistantPlugin.Config.Url + "services/" + service.Split(".")[0] + "/" + service.Split(".")[1];
47 | // var body = "{\"entity_id\": \"" + entity + "\"}";
48 | var body = @"{""entity_id"": """ + entity + @"""}";
49 | _client.DefaultRequestHeaders.Authorization =
50 | new AuthenticationHeaderValue("Bearer", HomeAssistantPlugin.HomeAssistantPlugin.Config.Token);
51 | var content = new StringContent(body, System.Text.Encoding.UTF8, "application/json"); //https://developers.home-assistant.io/docs/api/rest/
52 | _client.PostAsync(url, content);
53 | }
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/metadata/LoupedeckPackage.yaml:
--------------------------------------------------------------------------------
1 | # ==================================================================================================
2 | # GENERAL SETTINGS
3 | # ==================================================================================================
4 |
5 | # Package type. Must be plugin4 for plugins.
6 | type: plugin4
7 |
8 | # Name of the plugin.
9 | name: HomeAssistant
10 |
11 | # Name that is displayed in the Loupedeck configuration application.
12 | displayName: HomeAssistant
13 |
14 | # Name of the plugin library file.
15 | pluginFileName: HomeAssistantPlugin.dll
16 |
17 | # Plugin version.
18 | version: 0.3
19 |
20 | # Author of the plugin. The author can be a company or an individual developer.
21 | author: lubeda
22 |
23 | # Copyright information.
24 | copyright: Copyright © 2022 Ludger. All rights reserved.
25 |
26 |
27 | # ==================================================================================================
28 | # PLUGIN PROPERTIES
29 | # ==================================================================================================
30 |
31 | # Location of plugin files on Windows (relative to the plugin base directory).
32 | # This parameter is required to support Windows.
33 | pluginFolderWin: win/
34 |
35 | # Location of plugin files on macOS (relative to the plugin base directory).
36 | # This parameter is required to support Mac.
37 | #pluginFolderMac: mac
38 |
39 | # List of supported devices.
40 | supportedDevices:
41 | # LoupedeckCtFamily covers the following devices: Loupedeck CT, Live and Live S, and Razer Stream Controller.
42 | #- LoupedeckCtFamily
43 | - LoupedeckCt
44 | - LoupedeckLive
45 |
46 | # LoupedeckPlusFamily covers Loupedeck+ device. Uncomment the following line to support Loupedeck+.
47 | #- LoupedeckPlusFamily
48 |
49 | # List of plugin capabilities.
50 | pluginCapabilities:
51 | # Uncomment the following line if this plugin is an application plugin.
52 | #- HasApplication
53 |
54 | # Uncomment the following line if the plugin sends keyboard shortcuts to the target application.
55 | #- ActivatesApplication
56 |
57 |
58 | # ==================================================================================================
59 | # LOUPEDECK MARKETPLACE SETTINGS
60 | # ==================================================================================================
61 |
62 | # Name of the license that the plugin is licensed under. Select the one that you prefer.
63 | # NOTE: GPL license is not compatible with Loupedeck Marketplace.
64 | license: MIT
65 |
66 | # URL of the plugin license.
67 | licenseUrl: https://opensource.org/licenses/MIT
68 |
69 | # URL of the support page where the users can send improvement suggestions and report bugs.
70 | # The URL is shown in Loupedeck Marketplace. The page can be for example a GitHub issues page.
71 | # NOTE: This setting is recommended when publishing the plugin in Loupedeck Marketplace.
72 | supportPageUrl: https://github.com/lubeda/Loupedeck-HomeAssistantPlugin/issues
73 |
74 | # URL of the plugin homepage. The URL is shown in Loupedeck Marketplace.
75 | homePageUrl: https://github.com/lubeda/Loupedeck-HomeAssistantPlugin
76 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // Dieser Code wurde von einem Tool generiert.
4 | // Laufzeitversion:4.0.30319.42000
5 | //
6 | // Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
7 | // der Code erneut generiert wird.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace Loupedeck.HomeAssistantPlugin.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
17 | ///
18 | // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
19 | // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
20 | // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
21 | // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Loupedeck.HomeAssistantPlugin.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
51 | /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Actions/_HomeAssistantStateCommand.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeAssistantPlugin.Actions
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Net.Http;
6 | using System.Net.Http.Headers;
7 | using System.Text.Json.Nodes;
8 | using System.Timers;
9 | class HomeAssistantStateCommand : PluginDynamicCommand
10 | {
11 | protected HttpClient httpClient = new HttpClient();
12 | protected IDictionary stateData = new Dictionary();
13 | protected Timer timer;
14 |
15 | protected class StateData
16 | {
17 | public String state;
18 | public Boolean IsValid = false;
19 | public Boolean IsLoading = false;
20 | }
21 |
22 | public HomeAssistantStateCommand() : base("Get State", "Get the state of an entity", "")
23 | {
24 | this.MakeProfileAction("text;Enter entity");
25 |
26 | // Reload the data periodically every 1 minutes
27 | this.timer = new Timer(60 * 1 * 1000);
28 | this.timer.Elapsed += (Object, ElapsedEventArgs) =>
29 | {
30 | foreach (var actionParameter in new List(this.stateData.Keys))
31 | {
32 | this.LoadData(actionParameter);
33 | }
34 | };
35 | this.timer.AutoReset = true;
36 | this.timer.Enabled = true;
37 | }
38 |
39 | protected override void RunCommand(String actionParameter)
40 | {
41 | this.LoadData(actionParameter);
42 | }
43 |
44 | protected override BitmapImage GetCommandImage(String actionParameter, PluginImageSize imageSize)
45 | {
46 | if (actionParameter == null)
47 | {
48 | return null;
49 | }
50 |
51 | StateData s = this.GetStateData(actionParameter);
52 |
53 | using (var bitmapBuilder = new BitmapBuilder(imageSize))
54 | {
55 | var fn = EmbeddedResources.FindFile("ButtonBaseHomeAssistant.png");
56 | bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(fn));
57 | if (this.stateData[actionParameter].IsValid)
58 | {
59 | bitmapBuilder.DrawText(this.stateData[actionParameter].state);
60 | }
61 | else
62 | {
63 | bitmapBuilder.DrawText("Error");
64 | }
65 | return bitmapBuilder.ToImage();
66 | }
67 | }
68 | protected StateData GetStateData(String actionParameter)
69 | {
70 | StateData d;
71 |
72 | if (!this.stateData.ContainsKey(actionParameter))
73 | {
74 | d = new StateData();
75 | this.stateData[actionParameter] = d;
76 | } else
77 | {
78 | d = this.stateData[actionParameter];
79 | }
80 |
81 | this.LoadData(actionParameter);
82 |
83 | return d;
84 | }
85 | protected async void LoadData(String actionParameter)
86 | {
87 | if (actionParameter == null)
88 | {
89 | return;
90 | }
91 |
92 | if (this.stateData[actionParameter] == null)
93 | {
94 | this.stateData[actionParameter] = new StateData();
95 | }
96 |
97 | StateData d = this.GetStateData(actionParameter);
98 |
99 | if (d.IsLoading)
100 | {
101 | return;
102 | }
103 |
104 | d.IsLoading = true;
105 |
106 | try
107 | {
108 | var _client = new HttpClient();
109 | var url = HomeAssistantPlugin.Config.Url + "states/" + actionParameter;
110 | _client.DefaultRequestHeaders.Authorization =
111 | new AuthenticationHeaderValue("Bearer", HomeAssistantPlugin.Config.Token);
112 | HttpResponseMessage resp = await _client.GetAsync(url);
113 | var json = JsonNode.Parse(await resp.Content.ReadAsStringAsync());
114 | d.state = json["state"].GetValue();
115 | }
116 | catch (Exception e)
117 | {
118 | d.state = "Error";
119 | }
120 | finally
121 | {
122 | d.IsLoading = false;
123 | d.IsValid = true;
124 | this.ActionImageChanged(actionParameter);
125 | }
126 | }
127 | }
128 |
129 | }
130 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Actions/HomeAssistantTemplateCommand.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeAssistantPlugin
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Net.Http;
6 | using System.Net.Http.Headers;
7 | using System.Timers;
8 |
9 | class HomeAssistantTemplateCommand : PluginDynamicCommand
10 | {
11 | protected HttpClient httpClient = new HttpClient();
12 | protected IDictionary templateData = new Dictionary();
13 | protected Timer timer;
14 |
15 | protected class TemplateData
16 | {
17 | public String template;
18 | public Boolean IsValid = false;
19 | public Boolean IsLoading = false;
20 | }
21 |
22 | public HomeAssistantTemplateCommand() : base("Eval a template", "Evaluate a template to show the result.", "")
23 | {
24 | this.MakeProfileAction("text;Enter template");
25 |
26 | // Reload the data periodically every 1 minutes
27 | this.timer = new Timer(60 * 1 * 1000);
28 | this.timer.Elapsed += (Object, ElapsedEventArgs) =>
29 | {
30 | foreach (var actionParameter in new List(this.templateData.Keys))
31 | {
32 | this.LoadData(actionParameter);
33 | }
34 | };
35 | this.timer.AutoReset = true;
36 | this.timer.Enabled = true;
37 | }
38 |
39 | protected override void RunCommand(String actionParameter)
40 | {
41 | this.LoadData(actionParameter);
42 | }
43 |
44 | protected override BitmapImage GetCommandImage(String actionParameter, PluginImageSize imageSize)
45 | {
46 | if (actionParameter == null)
47 | {
48 | return null;
49 | }
50 |
51 | TemplateData s = this.GetTemplateData(actionParameter);
52 | if (!s.IsValid)
53 | {
54 | return null;
55 | }
56 |
57 | var img = new BitmapBuilder(imageSize);
58 | using (var bitmapBuilder = new BitmapBuilder(imageSize))
59 | {
60 | var fn = EmbeddedResources.FindFile("ButtonBaseHomeAssistant.png");
61 | bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(fn));
62 | if (this.templateData[actionParameter].IsValid)
63 | {
64 | bitmapBuilder.DrawText(this.templateData[actionParameter].template);
65 | }
66 | else
67 | {
68 | bitmapBuilder.DrawText("Error");
69 | }
70 |
71 |
72 | return bitmapBuilder.ToImage();
73 | }
74 | }
75 |
76 | protected TemplateData GetTemplateData(String actionParameter)
77 | {
78 | TemplateData d;
79 | if (this.templateData.TryGetValue(actionParameter, out d))
80 | return d;
81 |
82 | d = new TemplateData();
83 | this.templateData[actionParameter] = d;
84 |
85 | this.LoadData(actionParameter);
86 |
87 | return d;
88 | }
89 |
90 | protected async void LoadData(String actionParameter)
91 | {
92 | if (actionParameter == null)
93 | {
94 | return;
95 | }
96 |
97 | if (this.templateData[actionParameter] == null)
98 | {
99 | this.templateData[actionParameter] = new TemplateData();
100 | }
101 |
102 | TemplateData d = this.GetTemplateData(actionParameter);
103 | if (d.IsLoading)
104 | {
105 | return;
106 | }
107 |
108 | d.IsLoading = true;
109 |
110 | try
111 | {
112 | var _client = new HttpClient();
113 |
114 | var url = HomeAssistantPlugin.Config.Url + "template";
115 | var body = @"{""template"": """ + actionParameter + @"""}";
116 | _client.DefaultRequestHeaders.Authorization =
117 | new AuthenticationHeaderValue("Bearer", HomeAssistantPlugin.Config.Token);
118 | var content = new StringContent(body, System.Text.Encoding.UTF8, "application/json"); //https://developers.home-assistant.io/docs/api/rest/
119 | var resp = await _client.PostAsync(url, content);
120 | if (resp.IsSuccessStatusCode)
121 | { d.template = await resp.Content.ReadAsStringAsync(); }
122 | else
123 | { d.template = "Error"; }
124 |
125 | }
126 | catch (Exception e)
127 | {
128 | d.template = "Error";
129 | }
130 | finally
131 | {
132 | d.IsLoading = false;
133 | d.IsValid = true;
134 | this.ActionImageChanged(actionParameter);
135 | }
136 | }
137 | }
138 |
139 | }
140 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Actions/HomeAssistantStateCommand.cs:
--------------------------------------------------------------------------------
1 | namespace Loupedeck.HomeAssistantPlugin
2 | {
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Net.Http;
6 | using System.Net.Http.Headers;
7 | using System.Reflection;
8 | using System.Text.Json.Nodes;
9 | using System.Timers;
10 |
11 | class HomeAssistantStateCommand : PluginDynamicCommand
12 | {
13 | protected HttpClient httpClient = new HttpClient();
14 | protected IDictionary stateData = new Dictionary();
15 | protected Timer timer;
16 |
17 | protected class StateData
18 | {
19 | public String state;
20 | public Boolean IsValid = false;
21 | public Boolean IsLoading = false;
22 | }
23 |
24 | public HomeAssistantStateCommand() : base("Get a state", "Get the state value of an entity.", "")
25 | {
26 | this.MakeProfileAction("text;Enter entity");
27 |
28 | // Reload the data periodically every 1 minutes
29 | this.timer = new Timer(60 * 1 * 1000);
30 | this.timer.Elapsed += (Object, ElapsedEventArgs) =>
31 | {
32 | foreach (var actionParameter in new List(this.stateData.Keys))
33 | {
34 | this.LoadData(actionParameter);
35 | }
36 | };
37 | this.timer.AutoReset = true;
38 | this.timer.Enabled = true;
39 | }
40 |
41 | protected override void RunCommand(String actionParameter)
42 | {
43 | this.LoadData(actionParameter);
44 | }
45 |
46 | protected override BitmapImage GetCommandImage(String actionParameter, PluginImageSize imageSize)
47 | {
48 | if (actionParameter == null)
49 | {
50 | return null;
51 | }
52 |
53 | StateData s = this.GetStateData(actionParameter);
54 |
55 | var img = new BitmapBuilder(imageSize);
56 | using (var bitmapBuilder = new BitmapBuilder(imageSize))
57 | {
58 | var fn = EmbeddedResources.FindFile("ButtonBaseHomeAssistant.png");
59 | bitmapBuilder.SetBackgroundImage(EmbeddedResources.ReadImage(fn));
60 | if (this.stateData[actionParameter].IsValid)
61 | {
62 | bitmapBuilder.DrawText(this.stateData[actionParameter].state);
63 | }
64 | else
65 | {
66 | bitmapBuilder.DrawText(actionParameter);
67 | }
68 | return bitmapBuilder.ToImage();
69 | }
70 | }
71 |
72 | protected StateData GetStateData(String actionParameter)
73 | {
74 | StateData d;
75 |
76 | if (this.stateData.TryGetValue(actionParameter, out d))
77 | {
78 | return d;
79 | }
80 |
81 | d = new StateData();
82 | this.stateData[actionParameter] = d;
83 |
84 | this.LoadData(actionParameter);
85 |
86 | return d;
87 | }
88 |
89 | protected async void LoadData(String actionParameter)
90 | {
91 | if (actionParameter == null)
92 | {
93 | return;
94 | }
95 |
96 | StateData d = this.GetStateData(actionParameter);
97 |
98 | if (d.IsLoading)
99 | {
100 | d.IsValid = false;
101 | return;
102 | }
103 |
104 | d.IsLoading = true;
105 |
106 | try
107 | {
108 | var _client = new HttpClient();
109 |
110 | var url = HomeAssistantPlugin.Config.Url + "states/" + actionParameter;
111 | _client.DefaultRequestHeaders.Authorization =
112 | new AuthenticationHeaderValue("Bearer", HomeAssistantPlugin.Config.Token);
113 | var resp = await _client.GetAsync(url);
114 | if (resp.IsSuccessStatusCode)
115 | {
116 | try
117 | {
118 | var body = await resp.Content.ReadAsStringAsync();
119 | var json = JsonNode.Parse(body);
120 | d.state = json["state"].GetValue();
121 | d.IsValid = true;
122 | }
123 | catch (HttpRequestException e)
124 | {
125 | d.state = e.Message;
126 | d.IsValid = true;
127 | }
128 | }
129 | else
130 | {
131 | d.state = "Error1";
132 | }
133 |
134 | }
135 | catch (Exception e)
136 | {
137 | d.state = "Error2";
138 | }
139 | finally
140 | {
141 | d.IsLoading = false;
142 | this.ActionImageChanged(actionParameter);
143 | }
144 | }
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/HomeAssistantPlugin/HomeAssistantPlugin.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D1331A6D-0B55-4EFA-A5C6-B08C0CDC56CF}
8 | Library
9 | Properties
10 | Loupedeck.HomeAssistantPlugin
11 | HomeAssistantPlugin
12 | v4.7.2
13 | 512
14 |
15 |
16 | $(SolutionDir)..\obj\
17 | $(SolutionDir)..\bin\
18 |
19 |
20 | true
21 | full
22 | false
23 | $(LocalAppData)\Loupedeck\Plugins\HomeAssistant\win\
24 | $(HOME)/.local/share/Loupedeck/Plugins/HomeAssistant/mac/
25 | DEBUG;TRACE
26 | prompt
27 | 4
28 |
29 |
30 | pdbonly
31 | true
32 | $(BaseOutputPath)$(Configuration)\win\
33 | $(BaseOutputPath)$(Configuration)/mac/
34 | TRACE
35 | prompt
36 | 4
37 |
38 |
39 |
40 | ..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll
41 |
42 |
43 | False
44 | C:\Program Files (x86)\Loupedeck\Loupedeck2\PluginApi.dll
45 | /Applications/Loupedeck.app/Contents/MonoBundle/PluginApi.dll
46 |
47 |
48 |
49 | ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll
50 |
51 |
52 |
53 |
54 | ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll
55 |
56 |
57 |
58 | ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll
59 |
60 |
61 | ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll
62 |
63 |
64 | ..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll
65 |
66 |
67 | ..\packages\System.Text.Json.7.0.0\lib\net462\System.Text.Json.dll
68 |
69 |
70 | ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll
71 |
72 |
73 | ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | True
93 | True
94 | Resources.resx
95 |
96 |
97 |
98 |
99 | ResXFileCodeGenerator
100 | Resources.Designer.cs
101 | Designer
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 | call "$(ProjectDir)BuildEvents\postbuild.cmd" "$(ProjectDir)" "$(TargetDir)"
122 | sh "$(ProjectDir)BuildEvents\postbuild" "$(ProjectDir)" "$(TargetDir)"
123 |
124 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Ll]og/
33 | [Ll]ogs/
34 |
35 | # Visual Studio 2015/2017 cache/options directory
36 | .vs/
37 | # Uncomment if you have tasks that create the project's static files in wwwroot
38 | #wwwroot/
39 |
40 | # Visual Studio 2017 auto generated files
41 | Generated\ Files/
42 |
43 | # MSTest test Results
44 | [Tt]est[Rr]esult*/
45 | [Bb]uild[Ll]og.*
46 |
47 | # NUnit
48 | *.VisualState.xml
49 | TestResult.xml
50 | nunit-*.xml
51 |
52 | # Build Results of an ATL Project
53 | [Dd]ebugPS/
54 | [Rr]eleasePS/
55 | dlldata.c
56 |
57 | # Benchmark Results
58 | BenchmarkDotNet.Artifacts/
59 |
60 | # .NET Core
61 | project.lock.json
62 | project.fragment.lock.json
63 | artifacts/
64 |
65 | # ASP.NET Scaffolding
66 | ScaffoldingReadMe.txt
67 |
68 | # StyleCop
69 | StyleCopReport.xml
70 |
71 | # Files built by Visual Studio
72 | *_i.c
73 | *_p.c
74 | *_h.h
75 | *.ilk
76 | *.meta
77 | *.obj
78 | *.iobj
79 | *.pch
80 | *.pdb
81 | *.ipdb
82 | *.pgc
83 | *.pgd
84 | *.rsp
85 | *.sbr
86 | *.tlb
87 | *.tli
88 | *.tlh
89 | *.tmp
90 | *.tmp_proj
91 | *_wpftmp.csproj
92 | *.log
93 | *.tlog
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio 6 auto-generated project file (contains which files were open etc.)
298 | *.vbp
299 |
300 | # Visual Studio 6 workspace and project file (working project files containing files to include in project)
301 | *.dsw
302 | *.dsp
303 |
304 | # Visual Studio 6 technical files
305 | *.ncb
306 | *.aps
307 |
308 | # Visual Studio LightSwitch build output
309 | **/*.HTMLClient/GeneratedArtifacts
310 | **/*.DesktopClient/GeneratedArtifacts
311 | **/*.DesktopClient/ModelManifest.xml
312 | **/*.Server/GeneratedArtifacts
313 | **/*.Server/ModelManifest.xml
314 | _Pvt_Extensions
315 |
316 | # Paket dependency manager
317 | .paket/paket.exe
318 | paket-files/
319 |
320 | # FAKE - F# Make
321 | .fake/
322 |
323 | # CodeRush personal settings
324 | .cr/personal
325 |
326 | # Python Tools for Visual Studio (PTVS)
327 | __pycache__/
328 | *.pyc
329 |
330 | # Cake - Uncomment if you are using it
331 | # tools/**
332 | # !tools/packages.config
333 |
334 | # Tabs Studio
335 | *.tss
336 |
337 | # Telerik's JustMock configuration file
338 | *.jmconfig
339 |
340 | # BizTalk build output
341 | *.btp.cs
342 | *.btm.cs
343 | *.odx.cs
344 | *.xsd.cs
345 |
346 | # OpenCover UI analysis results
347 | OpenCover/
348 |
349 | # Azure Stream Analytics local run output
350 | ASALocalRun/
351 |
352 | # MSBuild Binary and Structured Log
353 | *.binlog
354 |
355 | # NVidia Nsight GPU debugger configuration file
356 | *.nvuser
357 |
358 | # MFractors (Xamarin productivity tool) working folder
359 | .mfractor/
360 |
361 | # Local History for Visual Studio
362 | .localhistory/
363 |
364 | # Visual Studio History (VSHistory) files
365 | .vshistory/
366 |
367 | # BeatPulse healthcheck temp database
368 | healthchecksdb
369 |
370 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
371 | MigrationBackup/
372 |
373 | # Ionide (cross platform F# VS Code tools) working folder
374 | .ionide/
375 |
376 | # Fody - auto-generated XML schema
377 | FodyWeavers.xsd
378 |
379 | # VS Code files for those working on multiple tools
380 | .vscode/*
381 | !.vscode/settings.json
382 | !.vscode/tasks.json
383 | !.vscode/launch.json
384 | !.vscode/extensions.json
385 | *.code-workspace
386 |
387 | # Local History for Visual Studio Code
388 | .history/
389 |
390 | # Windows Installer files from build outputs
391 | *.cab
392 | *.msi
393 | *.msix
394 | *.msm
395 | *.msp
396 |
397 | # JetBrains Rider
398 | *.sln.iml
399 |
--------------------------------------------------------------------------------
/HomeAssistantPlugin/src/.editorconfig:
--------------------------------------------------------------------------------
1 | # Remove the line below if you want to inherit .editorconfig settings from higher directories
2 | root = true
3 |
4 | # C# files
5 | [*.cs]
6 |
7 | #### Core EditorConfig Options ####
8 |
9 | # Indentation and spacing
10 | indent_size = 4
11 | indent_style = space
12 | tab_width = 4
13 |
14 | # New line preferences
15 | end_of_line = crlf
16 | insert_final_newline = false
17 |
18 | #### .NET Coding Conventions ####
19 |
20 | # Organize usings
21 | dotnet_separate_import_directive_groups = true
22 | dotnet_sort_system_directives_first = true
23 |
24 | # this. and Me. preferences
25 | dotnet_style_qualification_for_event = true:warning
26 | dotnet_style_qualification_for_field = true:warning
27 | dotnet_style_qualification_for_method = true:warning
28 | dotnet_style_qualification_for_property = true:warning
29 |
30 | # Language keywords vs BCL types preferences
31 | dotnet_style_predefined_type_for_locals_parameters_members = false:warning
32 | dotnet_style_predefined_type_for_member_access = false:warning
33 |
34 | # Parentheses preferences
35 | dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:warning
36 | dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
37 | dotnet_style_parentheses_in_other_operators = never_if_unnecessary:warning
38 | dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
39 |
40 | # Modifier preferences
41 | dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
42 |
43 | # Expression-level preferences
44 | csharp_style_deconstructed_variable_declaration = true:suggestion
45 | csharp_style_inlined_variable_declaration = true:warning
46 | csharp_style_throw_expression = true:warning
47 | dotnet_style_coalesce_expression = true:warning
48 | dotnet_style_collection_initializer = true:warning
49 | dotnet_style_explicit_tuple_names = true:warning
50 | dotnet_style_null_propagation = true:warning
51 | dotnet_style_object_initializer = false:suggestion
52 | dotnet_style_prefer_auto_properties = true:warning
53 | dotnet_style_prefer_compound_assignment = true:warning
54 | dotnet_style_prefer_conditional_expression_over_assignment = true:warning
55 | dotnet_style_prefer_conditional_expression_over_return = true:warning
56 | dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
57 | dotnet_style_prefer_inferred_tuple_names = true:suggestion
58 | dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
59 |
60 | # Field preferences
61 | dotnet_style_readonly_field = true:warning
62 |
63 | # Parameter preferences
64 | dotnet_code_quality_unused_parameters = all:warning
65 |
66 | #### C# Coding Conventions ####
67 |
68 | # var preferences
69 | csharp_style_var_elsewhere = true:silent
70 | csharp_style_var_for_built_in_types = true:warning
71 | csharp_style_var_when_type_is_apparent = true:warning
72 |
73 | # Expression-bodied members
74 | csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
75 | csharp_style_expression_bodied_constructors = when_on_single_line:suggestion
76 | csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
77 | csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
78 | csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
79 | csharp_style_expression_bodied_methods = when_on_single_line:suggestion
80 | csharp_style_expression_bodied_operators = when_on_single_line:suggestion
81 | csharp_style_expression_bodied_properties = when_on_single_line:suggestion
82 |
83 | # Pattern matching preferences
84 | csharp_style_pattern_matching_over_as_with_null_check = true:warning
85 | csharp_style_pattern_matching_over_is_with_cast_check = true:warning
86 |
87 | # Null-checking preferences
88 | csharp_style_conditional_delegate_call = true:warning
89 |
90 | # Modifier preferences
91 | csharp_prefer_static_local_function = false:warning
92 | csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
93 |
94 | # Code-block preferences
95 | csharp_prefer_braces = true:warning
96 | csharp_prefer_simple_using_statement = false:warning
97 |
98 | # Expression-level preferences
99 | csharp_prefer_simple_default_expression = true:warning
100 | csharp_style_pattern_local_over_anonymous_function = true:warning
101 | csharp_style_prefer_index_operator = true:suggestion
102 | csharp_style_prefer_range_operator = true:suggestion
103 | csharp_style_unused_value_assignment_preference = discard_variable:suggestion
104 | csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
105 |
106 | # 'using' directive preferences
107 | csharp_using_directive_placement = inside_namespace:warning
108 |
109 | #### C# Formatting Rules ####
110 |
111 | # New line preferences
112 | csharp_new_line_before_catch = true
113 | csharp_new_line_before_else = true
114 | csharp_new_line_before_finally = true
115 | csharp_new_line_before_members_in_anonymous_types = true
116 | csharp_new_line_before_members_in_object_initializers = true
117 | csharp_new_line_before_open_brace = all
118 | csharp_new_line_between_query_expression_clauses = true
119 |
120 | # Indentation preferences
121 | csharp_indent_block_contents = true
122 | csharp_indent_braces = false
123 | csharp_indent_case_contents = true
124 | csharp_indent_case_contents_when_block = false
125 | csharp_indent_labels = one_less_than_current
126 | csharp_indent_switch_labels = true
127 |
128 | # Space preferences
129 | csharp_space_after_cast = false
130 | csharp_space_after_colon_in_inheritance_clause = true
131 | csharp_space_after_comma = true
132 | csharp_space_after_dot = false
133 | csharp_space_after_keywords_in_control_flow_statements = true
134 | csharp_space_after_semicolon_in_for_statement = true
135 | csharp_space_around_binary_operators = before_and_after
136 | csharp_space_around_declaration_statements = false
137 | csharp_space_before_colon_in_inheritance_clause = true
138 | csharp_space_before_comma = false
139 | csharp_space_before_dot = false
140 | csharp_space_before_open_square_brackets = false
141 | csharp_space_before_semicolon_in_for_statement = false
142 | csharp_space_between_empty_square_brackets = false
143 | csharp_space_between_method_call_empty_parameter_list_parentheses = false
144 | csharp_space_between_method_call_name_and_opening_parenthesis = false
145 | csharp_space_between_method_call_parameter_list_parentheses = false
146 | csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
147 | csharp_space_between_method_declaration_name_and_open_parenthesis = false
148 | csharp_space_between_method_declaration_parameter_list_parentheses = false
149 | csharp_space_between_parentheses = false
150 | csharp_space_between_square_brackets = false
151 |
152 | # Wrapping preferences
153 | csharp_preserve_single_line_blocks = true
154 | csharp_preserve_single_line_statements = false
155 |
156 | #### Naming styles ####
157 |
158 | # Naming rules
159 |
160 | dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
161 | dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
162 | dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
163 |
164 | dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
165 | dotnet_naming_rule.types_should_be_pascal_case.symbols = types
166 | dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
167 |
168 | dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
169 | dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
170 | dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
171 |
172 | # Symbol specifications
173 |
174 | dotnet_naming_symbols.interface.applicable_kinds = interface
175 | dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal
176 | dotnet_naming_symbols.interface.required_modifiers =
177 |
178 | dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
179 | dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal
180 | dotnet_naming_symbols.types.required_modifiers =
181 |
182 | dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
183 | dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal
184 | dotnet_naming_symbols.non_field_members.required_modifiers =
185 |
186 | # Naming styles
187 |
188 | dotnet_naming_style.pascal_case.required_prefix =
189 | dotnet_naming_style.pascal_case.required_suffix =
190 | dotnet_naming_style.pascal_case.word_separator =
191 | dotnet_naming_style.pascal_case.capitalization = pascal_case
192 |
193 | dotnet_naming_style.begins_with_i.required_prefix = I
194 | dotnet_naming_style.begins_with_i.required_suffix =
195 | dotnet_naming_style.begins_with_i.word_separator =
196 | dotnet_naming_style.begins_with_i.capitalization = pascal_case
197 |
198 | #### Diagnostic configuration ####
199 |
200 | dotnet_diagnostic.CA1028.severity = none
201 | dotnet_diagnostic.CA1031.severity = none
202 | dotnet_diagnostic.CA1054.severity = none
203 | dotnet_diagnostic.CA1056.severity = none
204 | dotnet_diagnostic.CA1060.severity = none
205 | dotnet_diagnostic.CA1303.severity = none
206 | dotnet_diagnostic.CA1308.severity = none
207 | dotnet_diagnostic.CA1716.severity = none
208 | dotnet_diagnostic.CA1720.severity = none
209 | dotnet_diagnostic.CA2101.severity = none
210 | dotnet_diagnostic.CA2234.severity = none
211 | dotnet_diagnostic.CA5350.severity = none
212 | dotnet_diagnostic.CA9998.severity = none
213 |
214 | dotnet_diagnostic.CS1591.severity = none
215 |
216 | dotnet_diagnostic.IDE0002.severity = none
217 | dotnet_diagnostic.IDE0021.severity = warning
218 | dotnet_diagnostic.IDE0022.severity = warning
219 | dotnet_diagnostic.IDE0058.severity = none
220 | dotnet_diagnostic.IDE0059.severity = none
221 |
222 | dotnet_diagnostic.SA1108.severity = none
223 | dotnet_diagnostic.SA1117.severity = none
224 | dotnet_diagnostic.SA1121.severity = none
225 | dotnet_diagnostic.SA1122.severity = none
226 | dotnet_diagnostic.SA1131.severity = none
227 | dotnet_diagnostic.SA1201.severity = none
228 | dotnet_diagnostic.SA1202.severity = none
229 | dotnet_diagnostic.SA1203.severity = none
230 | dotnet_diagnostic.SA1204.severity = none
231 | dotnet_diagnostic.SA1214.severity = none
232 | dotnet_diagnostic.SA1309.severity = none
233 | dotnet_diagnostic.SA1512.severity = none
234 | dotnet_diagnostic.SA1513.severity = none
235 | dotnet_diagnostic.SA1600.severity = none
236 | dotnet_diagnostic.SA1601.severity = none
237 | dotnet_diagnostic.SA1602.severity = none
238 | dotnet_diagnostic.SA1629.severity = none
239 | dotnet_diagnostic.SA1633.severity = none
240 |
241 | dotnet_diagnostic.SX1309.severity = warning
242 | dotnet_diagnostic.SX1309S.severity = warning
243 |
--------------------------------------------------------------------------------