Skip to content

Commit

Permalink
Merge pull request #8 from NecatiMeral/feature/broetje-ventilation-sy…
Browse files Browse the repository at this point in the history
…stem

Feature/broetje ventilation system
  • Loading branch information
NecatiMeral authored May 19, 2023
2 parents f2c2005 + 6e7cbee commit d61d175
Showing 27 changed files with 2,321 additions and 21 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,8 +6,16 @@ Custom logic nodes for personal use and other useful stuff to use with the GIRA

GIRA's documentation of the logic node SDK can be found on the [Gira Logic nodes page](https://partner.gira.com/en/service/software-tools/developer.html).

When using the nodes from this repository, you can hit the `F1` key in the logic editor for help.

## Logic nodes

### Necati_Meral_Yahoo_De.Logic.Ads

* Contains logic nodes to interact with [Beckhoff TwinCAT](https://www.beckhoff.com/de-de/produkte/automation/twincat/txxxxx-twincat-2-base/tabellarische-produktuebersicht/) systems by utilizing the [ADS (Automation Device Specification)](https://infosys.beckhoff.com/index.php?content=../content/1031/tcba/12269581963.html&id=8978321744740978019) protocol.
* [ADS: Read value (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Ads/help/ReadAdsDataNode.html)
* [ADS: Write value (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Ads/help/WriteAdsDataNode.html)

### Necati_Meral_Yahoo_De.Logic.ComfortOnline

* Contains a logic module to retrieve data from the Comfort online platform of the heating manufacturer KWB.
@@ -18,6 +26,7 @@ GIRA's documentation of the logic node SDK can be found on the [Gira Logic nodes
* Contains general logic nodes
* [Key value selection (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Common/help/KeyValueNode.html)


## Standalone tools

### doorbird-x1-listener
@@ -33,3 +42,8 @@ Docker service which acts as a proxy to integrate a doorbird doorbell into a gir
## Scripts

Contains scripts for minor automations of our home.


## Icons

This project uses [icons](images/Noun-Project/readme.md) from the glorious noun project.
4 changes: 2 additions & 2 deletions dotnet/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@
<Reference Include="LogicModule.Nodes.TestHelper">
<HintPath>$(SolutionDir)src\LogicNodesSDK\LogicModule.Nodes.TestHelper.dll</HintPath>
</Reference>

<Using Include="Xunit" />

<PackageReference Include="coverlet.collector" Version="3.1.2">
@@ -85,7 +85,7 @@

<!-- xunit.runner.visualstudio https://www.nuget.org/packages/xunit.runner.visualstudio -->
<xUnitRunnerVisualstudioPackageVersion>2.4.1</xUnitRunnerVisualstudioPackageVersion>

<!-- Microsoft Framework Extensions -->
<MicrosoftPackageVersion>7.0.*</MicrosoftPackageVersion>

7 changes: 7 additions & 0 deletions dotnet/NecatiMeral.LogicNodes.sln
Original file line number Diff line number Diff line change
@@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NecatiMeral.Logic.Common",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NecatiMeral.DoorbirdX1Listener.Host", "src\NecatiMeral.DoorbirdX1Listener.Host\NecatiMeral.DoorbirdX1Listener.Host.csproj", "{570B3ED5-A839-492B-A0A1-7070E9DF0300}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NecatiMeral.Logic.Ads", "src\NecatiMeral.Logic.Ads\NecatiMeral.Logic.Ads.csproj", "{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -49,6 +51,10 @@ Global
{570B3ED5-A839-492B-A0A1-7070E9DF0300}.Debug|Any CPU.Build.0 = Debug|Any CPU
{570B3ED5-A839-492B-A0A1-7070E9DF0300}.Release|Any CPU.ActiveCfg = Release|Any CPU
{570B3ED5-A839-492B-A0A1-7070E9DF0300}.Release|Any CPU.Build.0 = Release|Any CPU
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -59,6 +65,7 @@ Global
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3B3} = {B4F57F38-7B57-4225-9BD4-264ABC47DE33}
{722DD859-ABFA-4B2C-94A6-5D4AD5C5F377} = {B4F57F38-7B57-4225-9BD4-264ABC47DE33}
{570B3ED5-A839-492B-A0A1-7070E9DF0300} = {B4F57F38-7B57-4225-9BD4-264ABC47DE33}
{3F1FF768-FD27-46B2-961C-B6EFDF9CB3A4} = {B4F57F38-7B57-4225-9BD4-264ABC47DE33}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {471310B7-D205-4EEC-A063-0A534164AB9A}
5 changes: 5 additions & 0 deletions dotnet/src/NecatiMeral.Logic.Ads/AdsConsts.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Necati_Meral_Yahoo_De.Logic.Ads;
internal class AdsConsts
{
public const int ReadWriteLength = 84;
}
93 changes: 93 additions & 0 deletions dotnet/src/NecatiMeral.Logic.Ads/AdsDataNode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System.Text;
using LogicModule.ObjectModel.TypeSystem;
using Necati_Meral_Yahoo_De.LogicNodes;

namespace Necati_Meral_Yahoo_De.Logic.Ads;
public abstract class AdsDataNode : LocalizableNode
{
[Input(DisplayOrder = 2, IsDefaultShown = true, IsInput = false)]
public StringValueObject RemoteAddress { get; }

[Input(DisplayOrder = 3, IsDefaultShown = true, IsInput = false)]
public StringValueObject NetId { get; }

[Input(DisplayOrder = 4, IsDefaultShown = true, IsInput = false)]
public IntValueObject Port { get; }

[Input(DisplayOrder = 5, IsDefaultShown = true, IsInput = false)]
public UIntValueObject IndexGroup { get; }

[Input(DisplayOrder = 6, IsDefaultShown = true, IsInput = false)]
public UIntValueObject IndexOffset { get; }

[Input(DisplayOrder = 7, IsDefaultShown = true, IsInput = false)]
public EnumValueObject DataType { get; }

[Output(DisplayOrder = 99, IsDefaultShown = false)]
public StringValueObject Diagnostics { get; }

protected Encoding Encoding { get; }

public AdsDataNode(INodeContext context, string nodeTypeName)
: base(context, nodeTypeName)
{
context.ThrowIfNull("context");

RemoteAddress = TypeService.CreateString(PortTypes.String, "RemoteAddress", string.Empty);
NetId = TypeService.CreateString(PortTypes.String, "NetId", string.Empty);
Port = TypeService.CreateInt(PortTypes.Integer, "Port", 800);
IndexGroup = TypeService.CreateUInt(PortTypes.DWord, "IndexGroup", 16416);
IndexOffset = TypeService.CreateUInt(PortTypes.DWord, "IndexOffset", 0);
DataType = TypeService.CreateEnum(nameof(AdsType), "DataType", AdsType.Values, AdsType.String);

Diagnostics = TypeService.CreateString(PortTypes.String, "Diagnostics", string.Empty);

Encoding = Encoding.ASCII;
}

protected virtual object ConvertValue(byte[] data)
{
return DataType.Value switch
{
AdsType.Boolean => BitConverter.ToBoolean(data, 0),
AdsType.Int16 => BitConverter.ToInt16(data, 1),
_ => Encoding.GetString(data, 3, 81)
};
}

protected virtual byte[] GetBytes(object data)
{
return DataType.Value switch
{
AdsType.Boolean => BitConverter.GetBytes(AsBoolean(data)),
AdsType.Int16 => BitConverter.GetBytes(AsShort(data)),
_ => Encoding.GetBytes(data?.ToString())
};
}

protected virtual bool AsBoolean(object data)
{
if (data is bool booleanValue)
{
return booleanValue;
}

var dataAsString = data?.ToString();

return dataAsString == "1" || dataAsString.Equals("TRUE", StringComparison.OrdinalIgnoreCase);
}

protected virtual short AsShort(object data)
{
if (short.TryParse(data?.ToString(), out var shortValue))
{
return shortValue;
}
return 0;
}

protected string GetExceptionDebugMessage(Exception exception)
{
return $"[{exception.GetType()}] {exception.Message}";
}
}
11 changes: 11 additions & 0 deletions dotnet/src/NecatiMeral.Logic.Ads/AdsType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace Necati_Meral_Yahoo_De.Logic.Ads;
public static class AdsType
{
public const string Int16 = "16 bit integer";

public const string String = "String";

public const string Boolean = "Boolean";

public static string[] Values { get; } = new[] { Int16, String, Boolean };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"ExtendedData": {
"inputs": [
"TcAdsWebService.wsdl"
],
"collectionTypes": [
"System.Array",
"System.Collections.Generic.Dictionary`2"
],
"internalTypeAccess": true,
"namespaceMappings": [
"*, TcAdsWebService"
],
"targetFramework": "net45",
"typeReuseMode": "None"
}
}
Loading

0 comments on commit d61d175

Please sign in to comment.