Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
jollyjinx committed Jul 2, 2023
2 parents 02932d7 + e323d47 commit 1410f63
Show file tree
Hide file tree
Showing 48 changed files with 178,313 additions and 1,680 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
.build/
.build-linux/
.swiftpm/
Package.resolved
Reverseengineering/
Documentation/
perl5/
.local
.swiftpm
.cache
.bash_history
docker

Temp/
JNX/
perl5/

13 changes: 13 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--header "\n {file}\n"
#--swiftversion 5.8
--indentcase true
#--maxwidth none
--allman true
--yodaswap always
--wrapparameters after-first
--wraparguments after-first
--trimwhitespace always
--self remove
--wrapenumcases always
--enable wrapMultilineStatementBraces

73 changes: 45 additions & 28 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,42 +1,59 @@
// swift-tools-version:5.4
// swift-tools-version:5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "sma2mqtt",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6)
.macOS(.v13)
// .iOS(.v13),
// .tvOS(.v13),
// .watchOS(.v6)
],
products: [
.executable(name: "sma2mqtt", targets: ["sma2mqtt"]),
.library(name: "sma2mqttLibrary", targets: ["sma2mqttLibrary"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.3.2"),
.package(url: "https://github.com/apple/swift-nio", from: "2.32.0"),
.package(url: "https://github.com/jollyjinx/mqtt-nio", from: "1.0.1"),
.package(url: "https://github.com/jollyjinx/BinaryCoder", from: "2.2.3"),
// .package(url: "/Users/jolly/Documents/GitHub/BinaryCoder", .revision("f2e6dad") ),
.package(url: "https://github.com/jollyjinx/JLog", from:"0.0.4"),
// .package(url: "/Users/jolly/Documents/GitHub/JLog", .revision("440b721") ),
.package(url: "https://github.com/nicklockwood/SwiftFormat", branch: "master"),
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMajor(from: "1.2.2")),
.package(url: "https://github.com/swift-server/async-http-client.git", from: "1.18.0"),
.package(url: "https://github.com/swift-server-community/mqtt-nio", .upToNextMajor(from: "2.8.0")),
.package(url: "https://github.com/jollyjinx/BinaryCoder", .upToNextMajor(from: "2.3.1")),
.package(url: "https://github.com/jollyjinx/JLog", .upToNextMajor(from: "0.0.5")),
],
targets: [
.executableTarget(
name: "sma2mqtt",
dependencies: [ .product(name: "NIO", package: "swift-nio"),
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "MQTTNIO", package: "mqtt-nio"),
.product(name: "BinaryCoder", package: "BinaryCoder"),
.product(name: "JLog", package: "JLog")
],
resources: [ .copy("Resources/obisdefinition.json")
]
// ),
// .testTarget( name: "sma2mqttTests",
// dependencies: [ "sma2mqtt",
// .product(name: "BinaryCoder", package: "BinaryCoder"),
// .product(name: "JLog", package: "JLog")
// ]
)
name: "sma2mqtt",
dependencies: [
"sma2mqttLibrary",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "JLog", package: "JLog"),
]
),
.target(
name: "sma2mqttLibrary",
dependencies: [
.product(name: "BinaryCoder", package: "BinaryCoder"),
.product(name: "AsyncHTTPClient", package: "async-http-client"),
.product(name: "MQTTNIO", package: "mqtt-nio"),
.product(name: "JLog", package: "JLog"),
],
resources: [
.copy("Obis/Resources/obisdefinition.json"),
.copy("DataObjects/Resources/sma.data.objectMetaData.json"),
.copy("DataObjects/Resources/sma.data.Translation_Names.json"),
.copy("SMAPacket/Resources/SMANetPacketDefinitions.json"),
]
),
.testTarget(
name: "sma2mqttTests",
dependencies: [
"sma2mqttLibrary",
.product(name: "BinaryCoder", package: "BinaryCoder"),
.product(name: "JLog", package: "JLog"),
]
),
]
)
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,36 @@ I use __sma2mqtt__ in 'production' and it works fine. Inverter values are curren


```
USAGE: sma2mqtt [--debug ...] [--json] [--mqtt-servername <mqtt-servername>] [--mqtt-port <mqtt-port>] [--interval <interval>] [--topic <topic>] [--bind-address <bind-address>] [--bind-port <bind-port>] [--mcast-address <mcast-address>] [--mcast-port <mcast-port>]
USAGE: sma2mqtt <options>
OPTIONS:
-d, --debug optional debug output
--json send json output to stdout
--log-level <log-level> Set the log level. (default: notice)
--json send json output to stdout
--mqtt-servername <mqtt-servername>
MQTT Server hostname (default: mqtt)
--mqtt-port <mqtt-port> MQTT Server port (default: 1883)
--mqtt-username <mqtt-username>
MQTT Server username (default: mqtt)
--mqtt-password <mqtt-password>
MQTT Server password
-i, --interval <interval>
Interval to send updates to mqtt Server. (default: 1.0)
-t, --topic <topic> MQTT Server topic. (default: sma/sunnymanager)
-b, --basetopic <basetopic>
MQTT Server topic. (default: sma/)
--bind-address <bind-address>
Multicast Binding Listening Interface Address. (default: 0.0.0.0)
--bind-port <bind-port> Multicast Binding Listening Port number. (default: 0)
--bind-port <bind-port> Multicast Binding Listening Port number. (default: 9522)
--mcast-address <mcast-address>
Multicast Group Address. (default: 239.12.255.254)
--mcast-port <mcast-port>
Multicast Group Port number. (default: 9522)
--inverter-password <inverter-password>
Inverter Password. (default: 0000)
--interesting-paths <interesting-paths>
Paths we are interested to update (default: dc-side/dc-measurements/power, ac-side/grid-measurements/power, ac-side/measured-values/daily-yield, immediate/feedin, immediate/usage, battery/state-of-charge, battery/battery/temperature,
battery/battery/battery-charge/battery-charge, temperatures)
-h, --help Show help information.
```


Expand Down
Loading

0 comments on commit 1410f63

Please sign in to comment.