Skip to content

Commit

Permalink
Merge pull request #51 from zivillian/tgb2
Browse files Browse the repository at this point in the history
retrieve parameters from setup instead of smartset.db
  • Loading branch information
zivillian authored Jun 26, 2023
2 parents 8abbca4 + ff055f9 commit 078d458
Show file tree
Hide file tree
Showing 28 changed files with 224,426 additions and 27,821 deletions.
38 changes: 16 additions & 22 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jobs:
run: dotnet publish -c release -r linux-arm -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7mqtt/ism7mqtt.csproj
- name: Publish ism7mqtt Linux ARM64
run: dotnet publish -c release -r linux-arm64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7mqtt/ism7mqtt.csproj
- name: Publish ism7parameter Windows
run: dotnet publish -c release -r win-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7parameter/ism7parameter.csproj
- name: Publish ism7proxy Windows
run: dotnet publish -c release -r win-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7proxy/ism7proxy.csproj
- name: Publish oldism7proxy Windows
Expand All @@ -41,14 +39,14 @@ jobs:
run: dotnet publish -c release -r linux-arm -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/oldism7proxy/oldism7proxy.csproj
- name: Publish oldism7proxy Linux ARM64
run: dotnet publish -c release -r linux-arm64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/oldism7proxy/oldism7proxy.csproj
- name: Publish smartsetlogdecryptor Windows
run: dotnet publish -c release -r win-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/SmartsetLogDecryptor/SmartsetLogDecryptor.csproj
- name: Publish smartsetlogdecryptor Linux
run: dotnet publish -c release -r linux-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/SmartsetLogDecryptor/SmartsetLogDecryptor.csproj
- name: Publish smartsetlogdecryptor Linux ARM
run: dotnet publish -c release -r linux-arm -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/SmartsetLogDecryptor/SmartsetLogDecryptor.csproj
- name: Publish smartsetlogdecryptor Linux ARM64
run: dotnet publish -c release -r linux-arm64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/SmartsetLogDecryptor/SmartsetLogDecryptor.csproj
- name: Publish ism7config Windows
run: dotnet publish -c release -r win-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- name: Publish ism7config Linux
run: dotnet publish -c release -r linux-x64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- name: Publish ism7config Linux ARM
run: dotnet publish -c release -r linux-arm -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- name: Publish ism7config Linux ARM64
run: dotnet publish -c release -r linux-arm64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- uses: actions/upload-artifact@v2
with:
name: ism7mqtt-win-x64
Expand All @@ -65,10 +63,6 @@ jobs:
with:
name: ism7mqtt-linux-arm64
path: src/ism7mqtt/bin/release/net6.0/linux-arm64/publish
- uses: actions/upload-artifact@v2
with:
name: ism7parameter
path: src/ism7parameter/bin/release/net48/win-x64/publish
- uses: actions/upload-artifact@v2
with:
name: ism7proxy
Expand All @@ -91,17 +85,17 @@ jobs:
path: src/oldism7proxy/bin/release/net6.0/linux-arm64/publish
- uses: actions/upload-artifact@v2
with:
name: smartsetlogdecryptor-win-x64
path: src/SmartsetLogDecryptor/bin/release/net6.0/win-x64/publish
name: ism7config-win-x64
path: src/ism7config/bin/release/net6.0/win-x64/publish
- uses: actions/upload-artifact@v2
with:
name: smartsetlogdecryptor-linux-x64
path: src/SmartsetLogDecryptor/bin/release/net6.0/linux-x64/publish
name: ism7config-linux-x64
path: src/ism7config/bin/release/net6.0/linux-x64/publish
- uses: actions/upload-artifact@v2
with:
name: smartsetlogdecryptor-linux-arm
path: src/SmartsetLogDecryptor/bin/release/net6.0/linux-arm/publish
name: ism7config-linux-arm
path: src/ism7config/bin/release/net6.0/linux-arm/publish
- uses: actions/upload-artifact@v2
with:
name: smartsetlogdecryptor-linux-arm64
path: src/SmartsetLogDecryptor/bin/release/net6.0/linux-arm64/publish
name: ism7config-linux-arm64
path: src/ism7config/bin/release/net6.0/linux-arm64/publish
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ Get all statistics and values from your Wolf ISM7 and send them to an mqtt serve

## How?

Run ism7parameter on a Windows machine where [Wolf SmartSet](https://www.wolf.eu/download-asset/22335) is installed and was connected to your ism7 at least once. This will create a parameter.json file which is needed for ism7mqtt.
Create a parameter.json file which is needed for ism7mqtt by running the ism7config tool on any machine which can connect to your ism7. This only need's to be done once (or after you changed your your Wolf setup):

```sh
ism7config -i <ism7 ip/host> -p <ism7 password>
```

Run ism7mqtt on any machine which can connect to your ism7 and an mqtt server.

```sh
ism7mqtt -m <mqttserver> -i <ism7 ip/host> -p <ism7 password>
```

Do not forget to put the generated parameter.json next to the ism7client or specify the path with `-t .../parameter.json`.
Do not forget to put the generated parameter.json next to ism7mqtt or specify the path with `-t .../parameter.json`.

### Docker

Expand All @@ -22,17 +26,21 @@ If you want to run this via docker, use:
docker run -d --restart=unless-stopped -v ./parameter.json:/app/parameter.json -e ISM7_MQTTHOST=<mqttserver> -e ISM7_IP=<ism7 ip/host> -e ISM7_PASSWORD=<ism7 password> zivillian/ism7mqtt:latest
```

### HomeAssistant

There is a HomeAssistant integration at [b3nn0/hassio-addon-ism7mqtt](https://github.com/b3nn0/hassio-addon-ism7mqtt).

## Firmware < 200

The old firmware (Software < 200) uses a different port and SSL3 with cipher TLS_RSA_WITH_RC4_128_MD5 which is unsupported on all modern os. You can use `oldism7proxy` as a proxy between ism7mqtt and your ism.

## Cons

The ism7 accepts only a single connection, so you cannot use the Smartset application while ism7mqtt is running.
The ism7 accepts only a single connection, so you cannot use the Smartset application or mobile app while ism7mqtt is running.

## Configuration

The parameter.json contains all devices and the corresponding properties for the installation extracted from smartset. You can remove any property which is not needed.
The parameter.json contains all devices and the corresponding properties for the installation extracted from your setup. You can remove any property which is not needed.

## MQTT

Expand Down
16 changes: 5 additions & 11 deletions ism7mqtt.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ VisualStudioVersion = 17.3.32901.215
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ism7mqtt", "src\ism7mqtt\ism7mqtt.csproj", "{B7E33C2D-9BC2-4864-BC11-917C33EA0874}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ism7parameter", "src\ism7parameter\ism7parameter.csproj", "{FAF14727-7805-47E3-B603-26FA6A355BB2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ism7proxy", "src\ism7proxy\ism7proxy.csproj", "{D2C1B231-0A5B-4199-B752-831AED6A3650}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "oldism7proxy", "src\oldism7proxy\oldism7proxy.csproj", "{EFF9B1F8-C900-4E45-8F5B-99893672AC8C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SmartsetLogDecryptor", "src\SmartsetLogDecryptor\SmartsetLogDecryptor.csproj", "{62E2D723-A57F-4807-AE13-86891DAB404F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ism7config", "src\ism7config\ism7config.csproj", "{D5848B3A-B1BB-4A46-BF78-B994343B67C8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -23,10 +21,6 @@ Global
{B7E33C2D-9BC2-4864-BC11-917C33EA0874}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B7E33C2D-9BC2-4864-BC11-917C33EA0874}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B7E33C2D-9BC2-4864-BC11-917C33EA0874}.Release|Any CPU.Build.0 = Release|Any CPU
{FAF14727-7805-47E3-B603-26FA6A355BB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FAF14727-7805-47E3-B603-26FA6A355BB2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FAF14727-7805-47E3-B603-26FA6A355BB2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FAF14727-7805-47E3-B603-26FA6A355BB2}.Release|Any CPU.Build.0 = Release|Any CPU
{D2C1B231-0A5B-4199-B752-831AED6A3650}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2C1B231-0A5B-4199-B752-831AED6A3650}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2C1B231-0A5B-4199-B752-831AED6A3650}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -35,10 +29,10 @@ Global
{EFF9B1F8-C900-4E45-8F5B-99893672AC8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EFF9B1F8-C900-4E45-8F5B-99893672AC8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EFF9B1F8-C900-4E45-8F5B-99893672AC8C}.Release|Any CPU.Build.0 = Release|Any CPU
{62E2D723-A57F-4807-AE13-86891DAB404F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{62E2D723-A57F-4807-AE13-86891DAB404F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62E2D723-A57F-4807-AE13-86891DAB404F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62E2D723-A57F-4807-AE13-86891DAB404F}.Release|Any CPU.Build.0 = Release|Any CPU
{D5848B3A-B1BB-4A46-BF78-B994343B67C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5848B3A-B1BB-4A46-BF78-B994343B67C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5848B3A-B1BB-4A46-BF78-B994343B67C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5848B3A-B1BB-4A46-BF78-B994343B67C8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
82 changes: 0 additions & 82 deletions src/SmartsetLogDecryptor/Program.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/SmartsetLogDecryptor/SmartsetLogDecryptor.csproj

This file was deleted.

21 changes: 21 additions & 0 deletions src/ism7config/BetterParameterStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Collections.Concurrent;
using System.Reflection;
using LuCon.Common.ConfigService;
using LuCon.SocketServer.SocketServerBase;
using Microsoft.Extensions.Logging;
using Wolf.DRIVR.Model;
using Wolf.SocketServer.ISMInterface;

namespace ism7config;

public class BetterParameterStore : ParameterStore
{
private readonly FieldInfo _parametersByIdInfo;

public BetterParameterStore(IDatalogCacheWriter datalogCacheWriter, ISystemMaintenanceStateCacheWriter systemMaintenanceStateCacheWriter, IConverterTemplateService converterTemplateService, IParameterTemplateService parameterTemplateService, IFaultMessageResponseBatchHandler faultMessageResponseBatchHandler, IDeviceTemplateService deviceTemplateService, ILoggerFactory loggerFactory, IDRIVR eventPublisher) : base(datalogCacheWriter, systemMaintenanceStateCacheWriter, converterTemplateService, parameterTemplateService, faultMessageResponseBatchHandler, deviceTemplateService, loggerFactory, eventPublisher)
{
_parametersByIdInfo = typeof(ParameterStore).GetField("_parametersById", BindingFlags.Instance | BindingFlags.NonPublic);
}

public ConcurrentDictionary<long, LuCon.SocketServer.SocketServerBase.Parameter> Parameters => (ConcurrentDictionary<long, LuCon.SocketServer.SocketServerBase.Parameter>)_parametersByIdInfo.GetValue(this);
}
32 changes: 32 additions & 0 deletions src/ism7config/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System.Text.Json.Serialization;

namespace ism7config;

class Config
{
public List<Device> Devices { get; set; }
}

class Device
{
[JsonIgnore]
public long Id { get; set; }

public string ReadBusAddress { get; set; }

public int DeviceTemplateId { get; set; }

[JsonIgnore]
public List<Parameter> Parameters { get; set; }

[JsonPropertyName("Parameter")]
public IEnumerable<long> Ids
{
get { return Parameters.Select(x => x.ParameterId); }
}
}

class Parameter
{
public long ParameterId { get; set; }
}
26 changes: 26 additions & 0 deletions src/ism7config/FaultMessageHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Wolf.SocketServer.ISMInterface;

namespace ism7config;

public class FaultMessageHandler : IFaultMessageResponseBatchHandler
{
public void Start()
{
throw new NotImplementedException();
}

public void Stop()
{
throw new NotImplementedException();
}

public void AddResponse(TelegrBundleResponse resp)
{
}

public void ScheduleRuntimeAlertDataUpdate(long gatewayId, long deviceId, TimeSpan timespan,
ModbusDeviceRuntimeAlertData modbusDeviceRuntimeAlertData)
{
throw new NotImplementedException();
}
}
Loading

0 comments on commit 078d458

Please sign in to comment.