Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Meltem nodes #10

Merged
merged 5 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/image-compression.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Compress Images
on:
pull_request:
paths:
- "**.jpg"
- "**.jpeg"
- "**.png"
- "**.webp"
- "**.gif"
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
build:
# Only run on Pull Requests within the same repository, and not from forks.
if: github.event.pull_request.head.repo.full_name == github.repository && !github.event.pull_request.draft
name: calibreapp/image-actions
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Compress Images
uses: calibreapp/image-actions@main
with:
# The `GITHUB_TOKEN` is automatically generated by GitHub and scoped only to the repository that is currently running the action. By default, the action can’t update Pull Requests initiated from forked repositories.
# See https://docs.github.com/en/actions/reference/authentication-in-a-workflow and https://help.github.com/en/articles/virtual-environments-for-github-actions#token-permissions
githubToken: ${{ secrets.GITHUB_TOKEN }}
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,30 @@ When using the nodes from this repository, you can hit the `F1` key in the logic

### 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)
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.
* [ComfortOnline input (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.ComfortOnline/help/ComfortOnlineRequestNode.html)
Contains a logic module to retrieve data from the Comfort online platform of the heating manufacturer KWB.

- [ComfortOnline input (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.ComfortOnline/help/ComfortOnlineRequestNode.html)

### Necati_Meral_Yahoo_De.Logic.Common

* Contains general logic nodes
* [Key value selection (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Common/help/KeyValueNode.html)
Contains general logic nodes

- [Key value selection (german)](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Common/help/KeyValueNode.html)

### Necati_Meral_Yahoo_De.Logic.Meltem

Provides logic nodes to interact with Meltem Ventilation appliances using Modbus (RTU-over-TCP).

- [Get Device Info](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Meltem/help/GetDeviceInfoNode.html)
- [Get Ventilation](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Meltem/help/GetVentilationNode.html)
- [Set Ventilation](https://necatimeral.github.io/gira-x1-logic-nodes/dotnet/src/NecatiMeral.Logic.Meltem/help/SetVentilationNode.html)

## Standalone tools

Expand All @@ -36,14 +46,13 @@ Docker service which acts as a proxy to integrate a doorbird doorbell into a gir
> I recommend you not to use the X1 as trigger for the sonos doorbell. Prefer a standalone web api instead, since the Sonos integration is well known to break on the X1 which requires a system restart.
> You can use my fork of the [node-sonos-http-api](https://github.com/NecatiMeral/node-sonos-http-api)-project to trigger your sonos directly from your doorbird (`http://your-host:5005/clipall[groups]/doorbell.mp3/50`). This approach is way more reliable.

* [Technical description (german)](./docs/de/Doorbird-X1-Listener.md)
* [Setup guide (german)](./docs/de/Doorbird-X1-Listener-Setup.md)
- [Technical description (german)](./docs/de/Doorbird-X1-Listener.md)
- [Setup guide (german)](./docs/de/Doorbird-X1-Listener-Setup.md)

## Scripts

Contains scripts for minor automations of our home.


## Icons

This project uses [icons](images/Noun-Project/readme.md) from the glorious noun project.
Binary file modified docs/de/doorbird-http-request.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/de/doorbird-register-script-demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/de/gpa-doorbird-klingel-logik.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/de/gpa-doorbird-klingel-trigger.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dotnet/src/NecatiMeral.Logic.Ads/help/ReadAdsDataNode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dotnet/src/NecatiMeral.Logic.Ads/help/WriteAdsDataNode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified dotnet/src/NecatiMeral.Logic.Common/help/KeyValueNode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 2 additions & 4 deletions dotnet/src/NecatiMeral.Logic.Meltem/GetDeviceInfoNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ public GetDeviceInfoNode(INodeContext context)

protected override void ExecuteCore()
{
if (!WasTriggered)
if (WasTriggered)
{
return;
GetData();
}

GetData();
}

private void GetData()
Expand Down
13 changes: 8 additions & 5 deletions dotnet/src/NecatiMeral.Logic.Meltem/Manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
"HelpTooltip": {
"en": "Sets the ventilation level on a Meltem appliance.",
"de": "Setzt die Lüftungsstufe an einem Meltem-Gerät."
}
},
"HelpFileReference": "$help/SetVentilationNode.html"
},
{
"Type": "Necati_Meral_Yahoo_De.Logic.Meltem.GetVentilationNode",
Expand All @@ -44,21 +45,23 @@
"HelpTooltip": {
"en": "Retrieves the ventilation level from a Meltem appliance.",
"de": "Ruft die Lüftungsstufe von einem Meltem-Gerät ab."
}
},
"HelpFileReference": "$help/GetVentilationNode.html"
},
{
"Type": "Necati_Meral_Yahoo_De.Logic.Meltem.GetDeviceInfoNode",
"Name": {
"en": "Meltem - Get full device info",
"de": "Meltem - Vollständige Geräteinformation"
"en": "Meltem - Get device info",
"de": "Meltem - Gerätedaten abrufen"
},
"IsConverter": false,
"Category": "Node",
"DefaultIcon": "icons/meltem.png",
"HelpTooltip": {
"en": "Retrieves the complete device information.",
"de": "Ruft die vollständigen Geräteinformationen ab."
}
},
"HelpFileReference": "$help/GetDeviceInfoNode.html"
}
]
}
23 changes: 21 additions & 2 deletions dotnet/src/NecatiMeral.Logic.Meltem/MeltemNodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public abstract class MeltemNodeBase : LocalizableNode
[Input(DisplayOrder = 4, IsDefaultShown = true, IsInput = false)]
public IntValueObject UnitId { get; }

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

protected bool WasTriggered => Trigger != null && Trigger.HasValue && Trigger.WasSet && Trigger.Value;

private readonly ModbusClient _client;
Expand All @@ -39,24 +42,40 @@ public MeltemNodeBase(INodeContext context, string nodeTypeName, bool hasTrigger
UnitId.MinValue = 0;
UnitId.MaxValue = 255;

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

_client = new ModbusClient
{
ConnectionTimeout = (int)TimeSpan.FromSeconds(5).TotalMilliseconds
};
}

protected virtual bool CanExecute()
=> IPAddress.HasValue && Port.HasValue && UnitId.HasValue;

public override void Execute()
{
if (!IPAddress.HasValue || !Port.HasValue || !UnitId.HasValue)
if (!CanExecute())
{
return;
}

ExecuteCore();
try
{
ExecuteCore();
Diagnostics.Value = string.Empty;
}
catch (Exception ex)
{
Diagnostics.Value = GetDiagnosticsMessage(ex);
}
}

protected abstract void ExecuteCore();

protected virtual string GetDiagnosticsMessage(Exception ex)
=> $"{ex.GetType().Name}: {ex.Message}";

protected void ExecuteWithConnection(Action<ModbusClient> action)
{
_client.Connect(IPAddress.Value, Port.Value);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,7 @@
<data name="SetVentilationOutput" xml:space="preserve">
<value>Ausgang</value>
</data>
<data name="Diagnostics" xml:space="preserve">
<value>Diagnosetext</value>
</data>
</root>
3 changes: 3 additions & 0 deletions dotnet/src/NecatiMeral.Logic.Meltem/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -217,4 +217,7 @@
<data name="SetVentilationOutput" xml:space="preserve">
<value>Output</value>
</data>
<data name="Diagnostics" xml:space="preserve">
<value>Diagnostic text</value>
</data>
</root>
30 changes: 12 additions & 18 deletions dotnet/src/NecatiMeral.Logic.Meltem/SetVentilationNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,11 @@ protected override void ExecuteCore()

private void SetBalancedVentilationPercent()
{
if (!BalancedVentilation.WasSet)
if (BalancedVentilation.WasSet)
{
return;
SetVentilationPercent(BalancedVentilation.Value);
Output.Value = BalancedVentilation.Value;
}

SetVentilationPercent(BalancedVentilation.Value);
Output.Value = BalancedVentilation.Value;
}

private void SetUnbalancedVentilationPercent()
Expand All @@ -95,28 +93,24 @@ private void SetUnbalancedVentilationPercent()

private void SetBalancedVentilationLevel()
{
if (!BalancedVentilationLevel.WasSet)
if (BalancedVentilationLevel.WasSet)
{
return;
SetVentilationPercent(
VentilationPreset.GetVentilationPercent(BalancedVentilationLevel.Value)
);
Output.Value = BalancedVentilationLevel.Value;
}

SetVentilationPercent(
VentilationPreset.GetVentilationPercent(BalancedVentilationLevel.Value)
);
Output.Value = BalancedVentilationLevel.Value;
}

private void SetBalancedVentilationLevelNumeric()
{
if (!BalancedVentilationLevelNumeric.WasSet)
{
return;
SetVentilationPercent(
VentilationPreset.GetVentilationPercent(BalancedVentilationLevelNumeric.Value)
);
Output.Value = BalancedVentilationLevelNumeric.Value;
}

SetVentilationPercent(
VentilationPreset.GetVentilationPercent(BalancedVentilationLevelNumeric.Value)
);
Output.Value = BalancedVentilationLevelNumeric.Value;
}

private void SetVentilationPercent(int percent)
Expand Down
Loading