Skip to content
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
6 changes: 6 additions & 0 deletions IoTSonnenUploader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/config/
/target/
/.settings/
/.project
/.factorypath
/.classpath
40 changes: 40 additions & 0 deletions IoTSonnenUploader/Mosquito-Instructions
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

On a mac -
brew install mosquitto
or if already installed
brew reinstall mosquitto
or
brew upgrade mosquitto
mosquitto has been installed with a default configuration file.
You can make changes to the configuration by editing:
/usr/local/etc/mosquitto/mosquitto.conf

To start mosquitto now and restart at login:
brew services start mosquitto
Or, if you don't want/need a background service you can just run:
/usr/local/opt/mosquitto/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
Or to run using it's build in defaults as a foreground service
/usr/local/opt/mosquitto/sbin/mosquitto


To setup user(s) and password(s) in mosquitto
Copy the default config file so you can edit it
cp /usr/local/etc/mosquitto/mosquitto.conf ./mosquitto.conf

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)
e.g.
password_file=./mosquitto.conf

Create the user and the passwd file
/usr/local/opt/mosquitto/bin/mosquitto_passwd -c passwordfile username
Create the user in an existing passwd file
/usr/local/opt/mosquitto/bin/mosquitto_passwd passwordfile username
To set a password for a user (you will be prompted to enter the password)
/usr/local/opt/mosquitto/bin/mosquitto_passwd passwordfile username
To set a password for a user (the password is on the command line, possible security problem)
/usr/local/opt/mosquitto/bin/mosquitto_passwd [ -H hash ] -b passwordfile username password
To delete the user from the password file
/usr/local/opt/mosquitto/bin/mosquitto_passwd -D passwordfile username

To run using the local config file
/usr/local/opt/mosquitto/sbin/mosquitto -c ./mosquitto.conf
39 changes: 39 additions & 0 deletions IoTSonnenUploader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Micronaut 4.10.1 Documentation

- [User Guide](https://docs.micronaut.io/4.10.1/guide/index.html)
- [API Reference](https://docs.micronaut.io/4.10.1/api/index.html)
- [Configuration Reference](https://docs.micronaut.io/4.10.1/guide/configurationreference.html)
- [Micronaut Guides](https://guides.micronaut.io/index.html)
---

- [Micronaut Maven Plugin documentation](https://micronaut-projects.github.io/micronaut-maven-plugin/latest/)
## Feature maven-enforcer-plugin documentation

- [https://maven.apache.org/enforcer/maven-enforcer-plugin/](https://maven.apache.org/enforcer/maven-enforcer-plugin/)


## Feature micronaut-aot documentation

- [Micronaut AOT documentation](https://micronaut-projects.github.io/micronaut-aot/latest/guide/)


## Feature serialization-jackson documentation

- [Micronaut Serialization Jackson Core documentation](https://micronaut-projects.github.io/micronaut-serialization/latest/guide/)


## Feature test-resources documentation

- [Micronaut Test Resources documentation](https://micronaut-projects.github.io/micronaut-test-resources/latest/guide/)


## Feature http-client documentation

- [Micronaut HTTP Client documentation](https://docs.micronaut.io/latest/guide/index.html#nettyHttpClient)


## Feature mqtt documentation

- [Micronaut MQTT v5 Messaging documentation](https://micronaut-projects.github.io/micronaut-mqtt/latest/guide/index.html)


37 changes: 37 additions & 0 deletions IoTSonnenUploader/aot-jar.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# AOT configuration properties for jar packaging
# Please review carefully the optimizations enabled below
# Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details

# Caches environment property values: environment properties will be deemed immutable after application startup.
cached.environment.enabled=true

# Precomputes Micronaut configuration property keys from the current environment variables
precompute.environment.properties.enabled=true

# Replaces logback.xml with a pure Java configuration
logback.xml.to.java.enabled=true

# Converts configuration files from YAML and properties to Java configuration
property-source-loader.generate.enabled=true

# Scans for service types ahead-of-time, avoiding classpath scanning at startup
serviceloading.jit.enabled=true

# Scans reactive types at build time instead of runtime
scan.reactive.types.enabled=true

# Deduces the environment at build time instead of runtime
deduce.environment.enabled=true

# Checks for the existence of some types at build time instead of runtime
known.missing.types.enabled=true

# Precomputes property sources at build time
sealed.property.source.enabled=true

# The list of service types to be scanned (comma separated)
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

# A list of types that the AOT analyzer needs to check for existence (comma separated)
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

2 changes: 2 additions & 0 deletions IoTSonnenUploader/config-sample/battery.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
micronaut.http.services.sonnenbattery.url=http://<Sonnen IP Address - must be accessible form the system this code runs on>:80
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>
28 changes: 28 additions & 0 deletions IoTSonnenUploader/config-sample/mqtt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
mqtt:
device:
id: tims
broker:
host: localhost
port: 1883
client:
# Unique identifier for this MQTT client
client-id: ${random.uuid}

# MQTT broker connection
server-uri: tcp://${mqtt.broker.host}:${mqtt.broker.port}

# Authentication
user-name: tims
password: ExamplePassword

# Optional connection settings
clean-session: true
automatic-reconnect: true
connection-timeout: "PT30s"
keep-alive-interval: "PT60s"

will-message:
topic: home/sonnen/will/${mqtt.device.id}
payload: Device ${mqtt.device.id} is unavailable
qos: 0
retained: true
6 changes: 6 additions & 0 deletions IoTSonnenUploader/micronaut-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
applicationType: default
defaultPackage: com.oracle.demo.timg.iot
testFramework: junit
sourceLanguage: java
buildTool: maven
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]
Loading