Skip to content

Commit 45baf57

Browse files
committed
Initial version of IoTSonnenUploader - gets data from sonnen hybrid 9.53
and uploads subset to MQTT broker
1 parent c1e5f3c commit 45baf57

27 files changed

+2110
-0
lines changed

IoTSonnenUploader/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/config/
2+
/target/
3+
/.settings/
4+
/.project
5+
/.factorypath
6+
/.classpath
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
On a mac -
3+
brew install mosquitto
4+
or if already installed
5+
brew reinstall mosquitto
6+
or
7+
brew upgrade mosquitto
8+
mosquitto has been installed with a default configuration file.
9+
You can make changes to the configuration by editing:
10+
/usr/local/etc/mosquitto/mosquitto.conf
11+
12+
To start mosquitto now and restart at login:
13+
brew services start mosquitto
14+
Or, if you don't want/need a background service you can just run:
15+
/usr/local/opt/mosquitto/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
16+
Or to run using it's build in defaults as a foreground service
17+
/usr/local/opt/mosquitto/sbin/mosquitto
18+
19+
20+
To setup user(s) and password(s) in mosquitto
21+
Copy the default config file so you can edit it
22+
cp /usr/local/etc/mosquitto/mosquitto.conf ./mosquitto.conf
23+
24+
Edit the conf file, locate the password_file entry, set it to be the pathname to where the password file will be (absolute or relative)
25+
e.g.
26+
password_file=./mosquitto.conf
27+
28+
Create the user and the passwd file
29+
/usr/local/opt/mosquitto/bin/mosquitto_passwd -c passwordfile username
30+
Create the user in an existing passwd file
31+
/usr/local/opt/mosquitto/bin/mosquitto_passwd passwordfile username
32+
To set a password for a user (you will be prompted to enter the password)
33+
/usr/local/opt/mosquitto/bin/mosquitto_passwd passwordfile username
34+
To set a password for a user (the password is on the command line, possible security problem)
35+
/usr/local/opt/mosquitto/bin/mosquitto_passwd [ -H hash ] -b passwordfile username password
36+
To delete the user from the password file
37+
/usr/local/opt/mosquitto/bin/mosquitto_passwd -D passwordfile username
38+
39+
To run using the local config file
40+
/usr/local/opt/mosquitto/sbin/mosquitto -c ./mosquitto.conf

IoTSonnenUploader/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Micronaut 4.10.1 Documentation
2+
3+
- [User Guide](https://docs.micronaut.io/4.10.1/guide/index.html)
4+
- [API Reference](https://docs.micronaut.io/4.10.1/api/index.html)
5+
- [Configuration Reference](https://docs.micronaut.io/4.10.1/guide/configurationreference.html)
6+
- [Micronaut Guides](https://guides.micronaut.io/index.html)
7+
---
8+
9+
- [Micronaut Maven Plugin documentation](https://micronaut-projects.github.io/micronaut-maven-plugin/latest/)
10+
## Feature maven-enforcer-plugin documentation
11+
12+
- [https://maven.apache.org/enforcer/maven-enforcer-plugin/](https://maven.apache.org/enforcer/maven-enforcer-plugin/)
13+
14+
15+
## Feature micronaut-aot documentation
16+
17+
- [Micronaut AOT documentation](https://micronaut-projects.github.io/micronaut-aot/latest/guide/)
18+
19+
20+
## Feature serialization-jackson documentation
21+
22+
- [Micronaut Serialization Jackson Core documentation](https://micronaut-projects.github.io/micronaut-serialization/latest/guide/)
23+
24+
25+
## Feature test-resources documentation
26+
27+
- [Micronaut Test Resources documentation](https://micronaut-projects.github.io/micronaut-test-resources/latest/guide/)
28+
29+
30+
## Feature http-client documentation
31+
32+
- [Micronaut HTTP Client documentation](https://docs.micronaut.io/latest/guide/index.html#nettyHttpClient)
33+
34+
35+
## Feature mqtt documentation
36+
37+
- [Micronaut MQTT v5 Messaging documentation](https://micronaut-projects.github.io/micronaut-mqtt/latest/guide/index.html)
38+
39+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# AOT configuration properties for jar packaging
2+
# Please review carefully the optimizations enabled below
3+
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details
4+
5+
# Caches environment property values: environment properties will be deemed immutable after application startup.
6+
cached.environment.enabled=true
7+
8+
# Precomputes Micronaut configuration property keys from the current environment variables
9+
precompute.environment.properties.enabled=true
10+
11+
# Replaces logback.xml with a pure Java configuration
12+
logback.xml.to.java.enabled=true
13+
14+
# Converts configuration files from YAML and properties to Java configuration
15+
property-source-loader.generate.enabled=true
16+
17+
# Scans for service types ahead-of-time, avoiding classpath scanning at startup
18+
serviceloading.jit.enabled=true
19+
20+
# Scans reactive types at build time instead of runtime
21+
scan.reactive.types.enabled=true
22+
23+
# Deduces the environment at build time instead of runtime
24+
deduce.environment.enabled=true
25+
26+
# Checks for the existence of some types at build time instead of runtime
27+
known.missing.types.enabled=true
28+
29+
# Precomputes property sources at build time
30+
sealed.property.source.enabled=true
31+
32+
# The list of service types to be scanned (comma separated)
33+
service.types=io.micronaut.context.env.PropertySourceLoader,io.micronaut.inject.BeanConfiguration,io.micronaut.inject.BeanDefinitionReference,io.micronaut.http.HttpRequestFactory,io.micronaut.http.HttpResponseFactory,io.micronaut.core.beans.BeanIntrospectionReference,io.micronaut.core.convert.TypeConverterRegistrar,io.micronaut.context.env.PropertyExpressionResolver
34+
35+
# A list of types that the AOT analyzer needs to check for existence (comma separated)
36+
known.missing.types.list=io.reactivex.Observable,reactor.core.publisher.Flux,kotlinx.coroutines.flow.Flow,io.reactivex.rxjava3.core.Flowable,io.reactivex.rxjava3.core.Observable,io.reactivex.Single,reactor.core.publisher.Mono,io.reactivex.Maybe,io.reactivex.rxjava3.core.Single,io.reactivex.rxjava3.core.Maybe,io.reactivex.Completable,io.reactivex.rxjava3.core.Completable,io.methvin.watchservice.MacOSXListeningWatchService,io.micronaut.core.async.publisher.CompletableFuturePublisher,io.micronaut.core.async.publisher.Publishers.JustPublisher,io.micronaut.core.async.subscriber.Completable
37+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
micronaut.http.services.sonnenbattery.url=http://<Sonnen IP Address - must be accessible form the system this code runs on>:80
2+
sonnenbattery.authToken=<Sonnen auth token - connect to the sonnen as user (pw on the side of the battery), then chose software integration from left menu to see API token>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
mqtt:
2+
device:
3+
id: tims
4+
broker:
5+
host: localhost
6+
port: 1883
7+
client:
8+
# Unique identifier for this MQTT client
9+
client-id: ${random.uuid}
10+
11+
# MQTT broker connection
12+
server-uri: tcp://${mqtt.broker.host}:${mqtt.broker.port}
13+
14+
# Authentication
15+
user-name: tims
16+
password: ExamplePassword
17+
18+
# Optional connection settings
19+
clean-session: true
20+
automatic-reconnect: true
21+
connection-timeout: "PT30s"
22+
keep-alive-interval: "PT60s"
23+
24+
will-message:
25+
topic: home/sonnen/will/${mqtt.device.id}
26+
payload: Device ${mqtt.device.id} is unavailable
27+
qos: 0
28+
retained: true
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
applicationType: default
2+
defaultPackage: com.oracle.demo.timg.iot
3+
testFramework: junit
4+
sourceLanguage: java
5+
buildTool: maven
6+
features: [app-name, http-client, java, java-application, junit, logback, maven, maven-enforcer-plugin, micronaut-aot, micronaut-http-validation, mqtt, netty-server, properties, readme, serialization-jackson, shade, static-resources, test-resources]

0 commit comments

Comments
 (0)