From 45baf57de6accf21a6bf67de81eabc64ef13aea9 Mon Sep 17 00:00:00 2001 From: tim_graves <28924492+atimgraves@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:20:53 +0000 Subject: [PATCH 1/2] Initial version of IoTSonnenUploader - gets data from sonnen hybrid 9.53 and uploads subset to MQTT broker --- IoTSonnenUploader/.gitignore | 6 + IoTSonnenUploader/Mosquito-Instructions | 40 + IoTSonnenUploader/README.md | 39 + IoTSonnenUploader/aot-jar.properties | 37 + .../config-sample/battery.properties | 2 + IoTSonnenUploader/config-sample/mqtt.yml | 28 + IoTSonnenUploader/micronaut-cli.yml | 6 + IoTSonnenUploader/mosquitto/mosquitto.conf | 905 ++++++++++++++++++ IoTSonnenUploader/mosquitto/passwords | 1 + IoTSonnenUploader/mvnw | 287 ++++++ IoTSonnenUploader/mvnw.bat | 187 ++++ IoTSonnenUploader/pom.xml | 211 ++++ .../iot/iotsonnenuploader/Application.java | 10 + .../commanddata/CommandResponse.java | 18 + .../incommingdata/SonnenConfiguration.java | 22 + .../incommingdata/SonnenStatus.java | 30 + .../mqtt/MqttCommandHandler.java | 46 + .../mqtt/MqttCommandResponsePublisher.java | 17 + .../mqtt/MqttDeviceSettings.java | 13 + .../mqtt/MqttSonnenBatteryPublisher.java | 24 + .../mqtt/MqttUploadMonitor.java | 24 + .../sonnencontroller/SonnenBatteryClient.java | 26 + .../SonnenBatteryHttpClientSettings.java | 13 + .../SonnenBatteryRequestFilter.java | 27 + .../iotsonnenuploader/uploader/Uploader.java | 51 + .../utils/PasswordConverter.java | 26 + .../src/main/resources/logback.xml | 14 + 27 files changed, 2110 insertions(+) create mode 100644 IoTSonnenUploader/.gitignore create mode 100644 IoTSonnenUploader/Mosquito-Instructions create mode 100644 IoTSonnenUploader/README.md create mode 100644 IoTSonnenUploader/aot-jar.properties create mode 100644 IoTSonnenUploader/config-sample/battery.properties create mode 100644 IoTSonnenUploader/config-sample/mqtt.yml create mode 100644 IoTSonnenUploader/micronaut-cli.yml create mode 100644 IoTSonnenUploader/mosquitto/mosquitto.conf create mode 100644 IoTSonnenUploader/mosquitto/passwords create mode 100644 IoTSonnenUploader/mvnw create mode 100644 IoTSonnenUploader/mvnw.bat create mode 100644 IoTSonnenUploader/pom.xml create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java create mode 100644 IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java create mode 100644 IoTSonnenUploader/src/main/resources/logback.xml diff --git a/IoTSonnenUploader/.gitignore b/IoTSonnenUploader/.gitignore new file mode 100644 index 0000000..201bc11 --- /dev/null +++ b/IoTSonnenUploader/.gitignore @@ -0,0 +1,6 @@ +/config/ +/target/ +/.settings/ +/.project +/.factorypath +/.classpath diff --git a/IoTSonnenUploader/Mosquito-Instructions b/IoTSonnenUploader/Mosquito-Instructions new file mode 100644 index 0000000..b607469 --- /dev/null +++ b/IoTSonnenUploader/Mosquito-Instructions @@ -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 diff --git a/IoTSonnenUploader/README.md b/IoTSonnenUploader/README.md new file mode 100644 index 0000000..19da2e0 --- /dev/null +++ b/IoTSonnenUploader/README.md @@ -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) + + diff --git a/IoTSonnenUploader/aot-jar.properties b/IoTSonnenUploader/aot-jar.properties new file mode 100644 index 0000000..f19e464 --- /dev/null +++ b/IoTSonnenUploader/aot-jar.properties @@ -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 + diff --git a/IoTSonnenUploader/config-sample/battery.properties b/IoTSonnenUploader/config-sample/battery.properties new file mode 100644 index 0000000..936208a --- /dev/null +++ b/IoTSonnenUploader/config-sample/battery.properties @@ -0,0 +1,2 @@ +micronaut.http.services.sonnenbattery.url=http://:80 +sonnenbattery.authToken= \ No newline at end of file diff --git a/IoTSonnenUploader/config-sample/mqtt.yml b/IoTSonnenUploader/config-sample/mqtt.yml new file mode 100644 index 0000000..e48fcbf --- /dev/null +++ b/IoTSonnenUploader/config-sample/mqtt.yml @@ -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 \ No newline at end of file diff --git a/IoTSonnenUploader/micronaut-cli.yml b/IoTSonnenUploader/micronaut-cli.yml new file mode 100644 index 0000000..c1e40ee --- /dev/null +++ b/IoTSonnenUploader/micronaut-cli.yml @@ -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] diff --git a/IoTSonnenUploader/mosquitto/mosquitto.conf b/IoTSonnenUploader/mosquitto/mosquitto.conf new file mode 100644 index 0000000..f25186a --- /dev/null +++ b/IoTSonnenUploader/mosquitto/mosquitto.conf @@ -0,0 +1,905 @@ +# Config file for mosquitto +# +# See mosquitto.conf(5) for more information. +# +# Default values are shown, uncomment to change. +# +# Use the # character to indicate a comment, but only if it is the +# very first character on the line. + +# ================================================================= +# General configuration +# ================================================================= + +# Use per listener security settings. +# +# It is recommended this option be set before any other options. +# +# If this option is set to true, then all authentication and access control +# options are controlled on a per listener basis. The following options are +# affected: +# +# acl_file +allow_anonymous false +# allow_zero_length_clientid +# auto_id_prefix +password_file ./passwords +# plugin +# plugin_opt_* +# psk_file +# +# Note that if set to true, then a durable client (i.e. with clean session set +# to false) that has disconnected will use the ACL settings defined for the +# listener that it was most recently connected to. +# +# The default behaviour is for this to be set to false, which maintains the +# setting behaviour from previous versions of mosquitto. +#per_listener_settings false + + +# This option controls whether a client is allowed to connect with a zero +# length client id or not. This option only affects clients using MQTT v3.1.1 +# and later. If set to false, clients connecting with a zero length client id +# are disconnected. If set to true, clients will be allocated a client id by +# the broker. This means it is only useful for clients with clean session set +# to true. +#allow_zero_length_clientid true + +# If allow_zero_length_clientid is true, this option allows you to set a prefix +# to automatically generated client ids to aid visibility in logs. +# Defaults to 'auto-' +#auto_id_prefix auto- + +# This option affects the scenario when a client subscribes to a topic that has +# retained messages. It is possible that the client that published the retained +# message to the topic had access at the time they published, but that access +# has been subsequently removed. If check_retain_source is set to true, the +# default, the source of a retained message will be checked for access rights +# before it is republished. When set to false, no check will be made and the +# retained message will always be published. This affects all listeners. +#check_retain_source true + +# QoS 1 and 2 messages will be allowed inflight per client until this limit +# is exceeded. Defaults to 0. (No maximum) +# See also max_inflight_messages +#max_inflight_bytes 0 + +# The maximum number of QoS 1 and 2 messages currently inflight per +# client. +# This includes messages that are partway through handshakes and +# those that are being retried. Defaults to 20. Set to 0 for no +# maximum. Setting to 1 will guarantee in-order delivery of QoS 1 +# and 2 messages. +#max_inflight_messages 20 + +# For MQTT v5 clients, it is possible to have the server send a "server +# keepalive" value that will override the keepalive value set by the client. +# This is intended to be used as a mechanism to say that the server will +# disconnect the client earlier than it anticipated, and that the client should +# use the new keepalive value. The max_keepalive option allows you to specify +# that clients may only connect with keepalive less than or equal to this +# value, otherwise they will be sent a server keepalive telling them to use +# max_keepalive. This only applies to MQTT v5 clients. The default, and maximum +# value allowable, is 65535. +# +# Set to 0 to allow clients to set keepalive = 0, which means no keepalive +# checks are made and the client will never be disconnected by the broker if no +# messages are received. You should be very sure this is the behaviour that you +# want. +# +# For MQTT v3.1.1 and v3.1 clients, there is no mechanism to tell the client +# what keepalive value they should use. If an MQTT v3.1.1 or v3.1 client +# specifies a keepalive time greater than max_keepalive they will be sent a +# CONNACK message with the "identifier rejected" reason code, and disconnected. +# +#max_keepalive 65535 + +# For MQTT v5 clients, it is possible to have the server send a "maximum packet +# size" value that will instruct the client it will not accept MQTT packets +# with size greater than max_packet_size bytes. This applies to the full MQTT +# packet, not just the payload. Setting this option to a positive value will +# set the maximum packet size to that number of bytes. If a client sends a +# packet which is larger than this value, it will be disconnected. This applies +# to all clients regardless of the protocol version they are using, but v3.1.1 +# and earlier clients will of course not have received the maximum packet size +# information. Defaults to no limit. Setting below 20 bytes is forbidden +# because it is likely to interfere with ordinary client operation, even with +# very small payloads. +#max_packet_size 0 + +# QoS 1 and 2 messages above those currently in-flight will be queued per +# client until this limit is exceeded. Defaults to 0. (No maximum) +# See also max_queued_messages. +# If both max_queued_messages and max_queued_bytes are specified, packets will +# be queued until the first limit is reached. +#max_queued_bytes 0 + +# Set the maximum QoS supported. Clients publishing at a QoS higher than +# specified here will be disconnected. +#max_qos 2 + +# The maximum number of QoS 1 and 2 messages to hold in a queue per client +# above those that are currently in-flight. Defaults to 1000. Set +# to 0 for no maximum (not recommended). +# See also queue_qos0_messages. +# See also max_queued_bytes. +#max_queued_messages 1000 +# +# This option sets the maximum number of heap memory bytes that the broker will +# allocate, and hence sets a hard limit on memory use by the broker. Memory +# requests that exceed this value will be denied. The effect will vary +# depending on what has been denied. If an incoming message is being processed, +# then the message will be dropped and the publishing client will be +# disconnected. If an outgoing message is being sent, then the individual +# message will be dropped and the receiving client will be disconnected. +# Defaults to no limit. +#memory_limit 0 + +# This option sets the maximum publish payload size that the broker will allow. +# Received messages that exceed this size will not be accepted by the broker. +# The default value is 0, which means that all valid MQTT messages are +# accepted. MQTT imposes a maximum payload size of 268435455 bytes. +#message_size_limit 0 + +# This option allows the session of persistent clients (those with clean +# session set to false) that are not currently connected to be removed if they +# do not reconnect within a certain time frame. This is a non-standard option +# in MQTT v3.1. MQTT v3.1.1 and v5.0 allow brokers to remove client sessions. +# +# Badly designed clients may set clean session to false whilst using a randomly +# generated client id. This leads to persistent clients that connect once and +# never reconnect. This option allows these clients to be removed. This option +# allows persistent clients (those with clean session set to false) to be +# removed if they do not reconnect within a certain time frame. +# +# The expiration period should be an integer followed by one of h d w m y for +# hour, day, week, month and year respectively. For example +# +# persistent_client_expiration 2m +# persistent_client_expiration 14d +# persistent_client_expiration 1y +# +# The default if not set is to never expire persistent clients. +#persistent_client_expiration + +# Write process id to a file. Default is a blank string which means +# a pid file shouldn't be written. +# This should be set to /var/run/mosquitto/mosquitto.pid if mosquitto is +# being run automatically on boot with an init script and +# start-stop-daemon or similar. +#pid_file + +# Set to true to queue messages with QoS 0 when a persistent client is +# disconnected. These messages are included in the limit imposed by +# max_queued_messages and max_queued_bytes +# Defaults to false. +# This is a non-standard option for the MQTT v3.1 spec but is allowed in +# v3.1.1. +#queue_qos0_messages false + +# Set to false to disable retained message support. If a client publishes a +# message with the retain bit set, it will be disconnected if this is set to +# false. +#retain_available true + +# Disable Nagle's algorithm on client sockets. This has the effect of reducing +# latency of individual messages at the potential cost of increasing the number +# of packets being sent. +#set_tcp_nodelay false + +# Time in seconds between updates of the $SYS tree. +# Set to 0 to disable the publishing of the $SYS tree. +#sys_interval 10 + +# The MQTT specification requires that the QoS of a message delivered to a +# subscriber is never upgraded to match the QoS of the subscription. Enabling +# this option changes this behaviour. If upgrade_outgoing_qos is set true, +# messages sent to a subscriber will always match the QoS of its subscription. +# This is a non-standard option explicitly disallowed by the spec. +#upgrade_outgoing_qos false + +# When run as root, drop privileges to this user and its primary +# group. +# Set to root to stay as root, but this is not recommended. +# If set to "mosquitto", or left unset, and the "mosquitto" user does not exist +# then it will drop privileges to the "nobody" user instead. +# If run as a non-root user, this setting has no effect. +# Note that on Windows this has no effect and so mosquitto should be started by +# the user you wish it to run as. +#user mosquitto + +# ================================================================= +# Listeners +# ================================================================= + +# Listen on a port/ip address combination. By using this variable +# multiple times, mosquitto can listen on more than one port. If +# this variable is used and neither bind_address nor port given, +# then the default listener will not be started. +# The port number to listen on must be given. Optionally, an ip +# address or host name may be supplied as a second argument. In +# this case, mosquitto will attempt to bind the listener to that +# address and so restrict access to the associated network and +# interface. By default, mosquitto will listen on all interfaces. +# Note that for a websockets listener it is not possible to bind to a host +# name. +# +# On systems that support Unix Domain Sockets, it is also possible +# to create a # Unix socket rather than opening a TCP socket. In +# this case, the port number should be set to 0 and a unix socket +# path must be provided, e.g. +# listener 0 /tmp/mosquitto.sock +# +# listener port-number [ip address/host name/unix socket path] +#listener + +# By default, a listener will attempt to listen on all supported IP protocol +# versions. If you do not have an IPv4 or IPv6 interface you may wish to +# disable support for either of those protocol versions. In particular, note +# that due to the limitations of the websockets library, it will only ever +# attempt to open IPv6 sockets if IPv6 support is compiled in, and so will fail +# if IPv6 is not available. +# +# Set to `ipv4` to force the listener to only use IPv4, or set to `ipv6` to +# force the listener to only use IPv6. If you want support for both IPv4 and +# IPv6, then do not use the socket_domain option. +# +#socket_domain + +# Bind the listener to a specific interface. This is similar to +# the [ip address/host name] part of the listener definition, but is useful +# when an interface has multiple addresses or the address may change. If used +# with the [ip address/host name] part of the listener definition, then the +# bind_interface option will take priority. +# Not available on Windows. +# +# Example: bind_interface eth0 +#bind_interface + +# When a listener is using the websockets protocol, it is possible to serve +# http data as well. Set http_dir to a directory which contains the files you +# wish to serve. If this option is not specified, then no normal http +# connections will be possible. +#http_dir + +# The maximum number of client connections to allow. This is +# a per listener setting. +# Default is -1, which means unlimited connections. +# Note that other process limits mean that unlimited connections +# are not really possible. Typically the default maximum number of +# connections possible is around 1024. +#max_connections -1 + +# The listener can be restricted to operating within a topic hierarchy using +# the mount_point option. This is achieved be prefixing the mount_point string +# to all topics for any clients connected to this listener. This prefixing only +# happens internally to the broker; the client will not see the prefix. +#mount_point + +# Choose the protocol to use when listening. +# This can be either mqtt or websockets. +# Certificate based TLS may be used with websockets, except that only the +# cafile, certfile, keyfile, ciphers, and ciphers_tls13 options are supported. +#protocol mqtt + +# Set use_username_as_clientid to true to replace the clientid that a client +# connected with with its username. This allows authentication to be tied to +# the clientid, which means that it is possible to prevent one client +# disconnecting another by using the same clientid. +# If a client connects with no username it will be disconnected as not +# authorised when this option is set to true. +# Do not use in conjunction with clientid_prefixes. +# See also use_identity_as_username. +# This does not apply globally, but on a per-listener basis. +#use_username_as_clientid + +# Change the websockets headers size. This is a global option, it is not +# possible to set per listener. This option sets the size of the buffer used in +# the libwebsockets library when reading HTTP headers. If you are passing large +# header data such as cookies then you may need to increase this value. If left +# unset, or set to 0, then the default of 1024 bytes will be used. +#websockets_headers_size + +# ----------------------------------------------------------------- +# Certificate based SSL/TLS support +# ----------------------------------------------------------------- +# The following options can be used to enable certificate based SSL/TLS support +# for this listener. Note that the recommended port for MQTT over TLS is 8883, +# but this must be set manually. +# +# See also the mosquitto-tls man page and the "Pre-shared-key based SSL/TLS +# support" section. Only one of certificate or PSK encryption support can be +# enabled for any listener. + +# Both of certfile and keyfile must be defined to enable certificate based +# TLS encryption. + +# Path to the PEM encoded server certificate. +#certfile + +# Path to the PEM encoded keyfile. +#keyfile + +# If you wish to control which encryption ciphers are used, use the ciphers +# option. The list of available ciphers can be optained using the "openssl +# ciphers" command and should be provided in the same format as the output of +# that command. This applies to TLS 1.2 and earlier versions only. Use +# ciphers_tls1.3 for TLS v1.3. +#ciphers + +# Choose which TLS v1.3 ciphersuites are used for this listener. +# Defaults to "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256" +#ciphers_tls1.3 + +# If you have require_certificate set to true, you can create a certificate +# revocation list file to revoke access to particular client certificates. If +# you have done this, use crlfile to point to the PEM encoded revocation file. +#crlfile + +# To allow the use of ephemeral DH key exchange, which provides forward +# security, the listener must load DH parameters. This can be specified with +# the dhparamfile option. The dhparamfile can be generated with the command +# e.g. "openssl dhparam -out dhparam.pem 2048" +#dhparamfile + +# By default an TLS enabled listener will operate in a similar fashion to a +# https enabled web server, in that the server has a certificate signed by a CA +# and the client will verify that it is a trusted certificate. The overall aim +# is encryption of the network traffic. By setting require_certificate to true, +# the client must provide a valid certificate in order for the network +# connection to proceed. This allows access to the broker to be controlled +# outside of the mechanisms provided by MQTT. +#require_certificate false + +# cafile and capath define methods of accessing the PEM encoded +# Certificate Authority certificates that will be considered trusted when +# checking incoming client certificates. +# cafile defines the path to a file containing the CA certificates. +# capath defines a directory that will be searched for files +# containing the CA certificates. For capath to work correctly, the +# certificate files must have ".crt" as the file ending and you must run +# "openssl rehash " each time you add/remove a certificate. +# capath is not supported for websockets. +#cafile +#capath + + +# If require_certificate is true, you may set use_identity_as_username to true +# to use the CN value from the client certificate as a username. If this is +# true, the password_file option will not be used for this listener. +#use_identity_as_username false + +# ----------------------------------------------------------------- +# Pre-shared-key based SSL/TLS support +# ----------------------------------------------------------------- +# The following options can be used to enable PSK based SSL/TLS support for +# this listener. Note that the recommended port for MQTT over TLS is 8883, but +# this must be set manually. +# +# See also the mosquitto-tls man page and the "Certificate based SSL/TLS +# support" section. Only one of certificate or PSK encryption support can be +# enabled for any listener. + +# The psk_hint option enables pre-shared-key support for this listener and also +# acts as an identifier for this listener. The hint is sent to clients and may +# be used locally to aid authentication. The hint is a free form string that +# doesn't have much meaning in itself, so feel free to be creative. +# If this option is provided, see psk_file to define the pre-shared keys to be +# used or create a security plugin to handle them. +#psk_hint + +# When using PSK, the encryption ciphers used will be chosen from the list of +# available PSK ciphers. If you want to control which ciphers are available, +# use the "ciphers" option. The list of available ciphers can be optained +# using the "openssl ciphers" command and should be provided in the same format +# as the output of that command. +#ciphers + +# Set use_identity_as_username to have the psk identity sent by the client used +# as its username. Authentication will be carried out using the PSK rather than +# the MQTT username/password and so password_file will not be used for this +# listener. +#use_identity_as_username false + + +# ================================================================= +# Persistence +# ================================================================= + +# If persistence is enabled, save the in-memory database to disk +# every autosave_interval seconds. If set to 0, the persistence +# database will only be written when mosquitto exits. See also +# autosave_on_changes. +# Note that writing of the persistence database can be forced by +# sending mosquitto a SIGUSR1 signal. +#autosave_interval 1800 + +# If true, mosquitto will count the number of subscription changes, retained +# messages received and queued messages and if the total exceeds +# autosave_interval then the in-memory database will be saved to disk. +# If false, mosquitto will save the in-memory database to disk by treating +# autosave_interval as a time in seconds. +#autosave_on_changes false + +# Save persistent message data to disk (true/false). +# This saves information about all messages, including +# subscriptions, currently in-flight messages and retained +# messages. +# retained_persistence is a synonym for this option. +#persistence false + +# The filename to use for the persistent database, not including +# the path. +#persistence_file mosquitto.db + +# Location for persistent database. +# Default is an empty string (current directory). +# Set to e.g. /var/lib/mosquitto if running as a proper service on Linux or +# similar. +#persistence_location + + +# ================================================================= +# Logging +# ================================================================= + +# Places to log to. Use multiple log_dest lines for multiple +# logging destinations. +# Possible destinations are: stdout stderr syslog topic file dlt +# +# stdout and stderr log to the console on the named output. +# +# syslog uses the userspace syslog facility which usually ends up +# in /var/log/messages or similar. +# +# topic logs to the broker topic '$SYS/broker/log/', +# where severity is one of D, E, W, N, I, M which are debug, error, +# warning, notice, information and message. Message type severity is used by +# the subscribe/unsubscribe log_types and publishes log messages to +# $SYS/broker/log/M/susbcribe or $SYS/broker/log/M/unsubscribe. +# +# The file destination requires an additional parameter which is the file to be +# logged to, e.g. "log_dest file /var/log/mosquitto.log". The file will be +# closed and reopened when the broker receives a HUP signal. Only a single file +# destination may be configured. +# +# The dlt destination is for the automotive `Diagnostic Log and Trace` tool. +# This requires that Mosquitto has been compiled with DLT support. +# +# Note that if the broker is running as a Windows service it will default to +# "log_dest none" and neither stdout nor stderr logging is available. +# Use "log_dest none" if you wish to disable logging. +#log_dest stderr + +# Types of messages to log. Use multiple log_type lines for logging +# multiple types of messages. +# Possible types are: debug, error, warning, notice, information, +# none, subscribe, unsubscribe, websockets, all. +# Note that debug type messages are for decoding the incoming/outgoing +# network packets. They are not logged in "topics". +#log_type error +#log_type warning +#log_type notice +#log_type information + + +# If set to true, client connection and disconnection messages will be included +# in the log. +#connection_messages true + +# If using syslog logging (not on Windows), messages will be logged to the +# "daemon" facility by default. Use the log_facility option to choose which of +# local0 to local7 to log to instead. The option value should be an integer +# value, e.g. "log_facility 5" to use local5. +#log_facility + +# If set to true, add a timestamp value to each log message. +#log_timestamp true + +# Set the format of the log timestamp. If left unset, this is the number of +# seconds since the Unix epoch. +# This is a free text string which will be passed to the strftime function. To +# get an ISO 8601 datetime, for example: +# log_timestamp_format %Y-%m-%dT%H:%M:%S +#log_timestamp_format + +# Change the websockets logging level. This is a global option, it is not +# possible to set per listener. This is an integer that is interpreted by +# libwebsockets as a bit mask for its lws_log_levels enum. See the +# libwebsockets documentation for more details. "log_type websockets" must also +# be enabled. +#websockets_log_level 0 + + +# ================================================================= +# Security +# ================================================================= + +# If set, only clients that have a matching prefix on their +# clientid will be allowed to connect to the broker. By default, +# all clients may connect. +# For example, setting "secure-" here would mean a client "secure- +# client" could connect but another with clientid "mqtt" couldn't. +#clientid_prefixes + +# Boolean value that determines whether clients that connect +# without providing a username are allowed to connect. If set to +# false then a password file should be created (see the +# password_file option) to control authenticated client access. +# +# Defaults to false, unless there are no listeners defined in the configuration +# file, in which case it is set to true, but connections are only allowed from +# the local machine. +#allow_anonymous false + +# ----------------------------------------------------------------- +# Default authentication and topic access control +# ----------------------------------------------------------------- + +# Control access to the broker using a password file. This file can be +# generated using the mosquitto_passwd utility. If TLS support is not compiled +# into mosquitto (it is recommended that TLS support should be included) then +# plain text passwords are used, in which case the file should be a text file +# with lines in the format: +# username:password +# The password (and colon) may be omitted if desired, although this +# offers very little in the way of security. +# +# See the TLS client require_certificate and use_identity_as_username options +# for alternative authentication options. If a plugin is used as well as +# password_file, the plugin check will be made first. +#password_file + +# Access may also be controlled using a pre-shared-key file. This requires +# TLS-PSK support and a listener configured to use it. The file should be text +# lines in the format: +# identity:key +# The key should be in hexadecimal format without a leading "0x". +# If an plugin is used as well, the plugin check will be made first. +#psk_file + +# Control access to topics on the broker using an access control list +# file. If this parameter is defined then only the topics listed will +# have access. +# If the first character of a line of the ACL file is a # it is treated as a +# comment. +# Topic access is added with lines of the format: +# +# topic [read|write|readwrite|deny] +# +# The access type is controlled using "read", "write", "readwrite" or "deny". +# This parameter is optional (unless contains a space character) - if +# not given then the access is read/write. can contain the + or # +# wildcards as in subscriptions. +# +# The "deny" option can used to explicity deny access to a topic that would +# otherwise be granted by a broader read/write/readwrite statement. Any "deny" +# topics are handled before topics that grant read/write access. +# +# The first set of topics are applied to anonymous clients, assuming +# allow_anonymous is true. User specific topic ACLs are added after a +# user line as follows: +# +# user +# +# The username referred to here is the same as in password_file. It is +# not the clientid. +# +# +# If is also possible to define ACLs based on pattern substitution within the +# topic. The patterns available for substition are: +# +# %c to match the client id of the client +# %u to match the username of the client +# +# The substitution pattern must be the only text for that level of hierarchy. +# +# The form is the same as for the topic keyword, but using pattern as the +# keyword. +# Pattern ACLs apply to all users even if the "user" keyword has previously +# been given. +# +# If using bridges with usernames and ACLs, connection messages can be allowed +# with the following pattern: +# pattern write $SYS/broker/connection/%c/state +# +# pattern [read|write|readwrite] +# +# Example: +# +# pattern write sensor/%u/data +# +# If an plugin is used as well as acl_file, the plugin check will be +# made first. +#acl_file + +# ----------------------------------------------------------------- +# External authentication and topic access plugin options +# ----------------------------------------------------------------- + +# External authentication and access control can be supported with the +# plugin option. This is a path to a loadable plugin. See also the +# plugin_opt_* options described below. +# +# The plugin option can be specified multiple times to load multiple +# plugins. The plugins will be processed in the order that they are specified +# here. If the plugin option is specified alongside either of +# password_file or acl_file then the plugin checks will be made first. +# +# If the per_listener_settings option is false, the plugin will be apply to all +# listeners. If per_listener_settings is true, then the plugin will apply to +# the current listener being defined only. +# +# This option is also available as `auth_plugin`, but this use is deprecated +# and will be removed in the future. +# +#plugin + +# If the plugin option above is used, define options to pass to the +# plugin here as described by the plugin instructions. All options named +# using the format plugin_opt_* will be passed to the plugin, for example: +# +# This option is also available as `auth_opt_*`, but this use is deprecated +# and will be removed in the future. +# +# plugin_opt_db_host +# plugin_opt_db_port +# plugin_opt_db_username +# plugin_opt_db_password + + +# ================================================================= +# Bridges +# ================================================================= + +# A bridge is a way of connecting multiple MQTT brokers together. +# Create a new bridge using the "connection" option as described below. Set +# options for the bridges using the remaining parameters. You must specify the +# address and at least one topic to subscribe to. +# +# Each connection must have a unique name. +# +# The address line may have multiple host address and ports specified. See +# below in the round_robin description for more details on bridge behaviour if +# multiple addresses are used. Note that if you use an IPv6 address, then you +# are required to specify a port. +# +# The direction that the topic will be shared can be chosen by +# specifying out, in or both, where the default value is out. +# The QoS level of the bridged communication can be specified with the next +# topic option. The default QoS level is 0, to change the QoS the topic +# direction must also be given. +# +# The local and remote prefix options allow a topic to be remapped when it is +# bridged to/from the remote broker. This provides the ability to place a topic +# tree in an appropriate location. +# +# For more details see the mosquitto.conf man page. +# +# Multiple topics can be specified per connection, but be careful +# not to create any loops. +# +# If you are using bridges with cleansession set to false (the default), then +# you may get unexpected behaviour from incoming topics if you change what +# topics you are subscribing to. This is because the remote broker keeps the +# subscription for the old topic. If you have this problem, connect your bridge +# with cleansession set to true, then reconnect with cleansession set to false +# as normal. +#connection +#address [:] [[:]] +#topic [[[out | in | both] qos-level] local-prefix remote-prefix] + +# If you need to have the bridge connect over a particular network interface, +# use bridge_bind_address to tell the bridge which local IP address the socket +# should bind to, e.g. `bridge_bind_address 192.168.1.10` +#bridge_bind_address + +# If a bridge has topics that have "out" direction, the default behaviour is to +# send an unsubscribe request to the remote broker on that topic. This means +# that changing a topic direction from "in" to "out" will not keep receiving +# incoming messages. Sending these unsubscribe requests is not always +# desirable, setting bridge_attempt_unsubscribe to false will disable sending +# the unsubscribe request. +#bridge_attempt_unsubscribe true + +# Set the version of the MQTT protocol to use with for this bridge. Can be one +# of mqttv50, mqttv311 or mqttv31. Defaults to mqttv311. +#bridge_protocol_version mqttv311 + +# Set the clean session variable for this bridge. +# When set to true, when the bridge disconnects for any reason, all +# messages and subscriptions will be cleaned up on the remote +# broker. Note that with cleansession set to true, there may be a +# significant amount of retained messages sent when the bridge +# reconnects after losing its connection. +# When set to false, the subscriptions and messages are kept on the +# remote broker, and delivered when the bridge reconnects. +#cleansession false + +# Set the amount of time a bridge using the lazy start type must be idle before +# it will be stopped. Defaults to 60 seconds. +#idle_timeout 60 + +# Set the keepalive interval for this bridge connection, in +# seconds. +#keepalive_interval 60 + +# Set the clientid to use on the local broker. If not defined, this defaults to +# 'local.'. If you are bridging a broker to itself, it is important +# that local_clientid and clientid do not match. +#local_clientid + +# If set to true, publish notification messages to the local and remote brokers +# giving information about the state of the bridge connection. Retained +# messages are published to the topic $SYS/broker/connection//state +# unless the notification_topic option is used. +# If the message is 1 then the connection is active, or 0 if the connection has +# failed. +# This uses the last will and testament feature. +#notifications true + +# Choose the topic on which notification messages for this bridge are +# published. If not set, messages are published on the topic +# $SYS/broker/connection//state +#notification_topic + +# Set the client id to use on the remote end of this bridge connection. If not +# defined, this defaults to 'name.hostname' where name is the connection name +# and hostname is the hostname of this computer. +# This replaces the old "clientid" option to avoid confusion. "clientid" +# remains valid for the time being. +#remote_clientid + +# Set the password to use when connecting to a broker that requires +# authentication. This option is only used if remote_username is also set. +# This replaces the old "password" option to avoid confusion. "password" +# remains valid for the time being. +#remote_password + +# Set the username to use when connecting to a broker that requires +# authentication. +# This replaces the old "username" option to avoid confusion. "username" +# remains valid for the time being. +#remote_username + +# Set the amount of time a bridge using the automatic start type will wait +# until attempting to reconnect. +# This option can be configured to use a constant delay time in seconds, or to +# use a backoff mechanism based on "Decorrelated Jitter", which adds a degree +# of randomness to when the restart occurs. +# +# Set a constant timeout of 20 seconds: +# restart_timeout 20 +# +# Set backoff with a base (start value) of 10 seconds and a cap (upper limit) of +# 60 seconds: +# restart_timeout 10 30 +# +# Defaults to jitter with a base of 5 and cap of 30 +#restart_timeout 5 30 + +# If the bridge has more than one address given in the address/addresses +# configuration, the round_robin option defines the behaviour of the bridge on +# a failure of the bridge connection. If round_robin is false, the default +# value, then the first address is treated as the main bridge connection. If +# the connection fails, the other secondary addresses will be attempted in +# turn. Whilst connected to a secondary bridge, the bridge will periodically +# attempt to reconnect to the main bridge until successful. +# If round_robin is true, then all addresses are treated as equals. If a +# connection fails, the next address will be tried and if successful will +# remain connected until it fails +#round_robin false + +# Set the start type of the bridge. This controls how the bridge starts and +# can be one of three types: automatic, lazy and once. Note that RSMB provides +# a fourth start type "manual" which isn't currently supported by mosquitto. +# +# "automatic" is the default start type and means that the bridge connection +# will be started automatically when the broker starts and also restarted +# after a short delay (30 seconds) if the connection fails. +# +# Bridges using the "lazy" start type will be started automatically when the +# number of queued messages exceeds the number set with the "threshold" +# parameter. It will be stopped automatically after the time set by the +# "idle_timeout" parameter. Use this start type if you wish the connection to +# only be active when it is needed. +# +# A bridge using the "once" start type will be started automatically when the +# broker starts but will not be restarted if the connection fails. +#start_type automatic + +# Set the number of messages that need to be queued for a bridge with lazy +# start type to be restarted. Defaults to 10 messages. +# Must be less than max_queued_messages. +#threshold 10 + +# If try_private is set to true, the bridge will attempt to indicate to the +# remote broker that it is a bridge not an ordinary client. If successful, this +# means that loop detection will be more effective and that retained messages +# will be propagated correctly. Not all brokers support this feature so it may +# be necessary to set try_private to false if your bridge does not connect +# properly. +#try_private true + +# Some MQTT brokers do not allow retained messages. MQTT v5 gives a mechanism +# for brokers to tell clients that they do not support retained messages, but +# this is not possible for MQTT v3.1.1 or v3.1. If you need to bridge to a +# v3.1.1 or v3.1 broker that does not support retained messages, set the +# bridge_outgoing_retain option to false. This will remove the retain bit on +# all outgoing messages to that bridge, regardless of any other setting. +#bridge_outgoing_retain true + +# If you wish to restrict the size of messages sent to a remote bridge, use the +# bridge_max_packet_size option. This sets the maximum number of bytes for +# the total message, including headers and payload. +# Note that MQTT v5 brokers may provide their own maximum-packet-size property. +# In this case, the smaller of the two limits will be used. +# Set to 0 for "unlimited". +#bridge_max_packet_size 0 + + +# ----------------------------------------------------------------- +# Certificate based SSL/TLS support +# ----------------------------------------------------------------- +# Either bridge_cafile or bridge_capath must be defined to enable TLS support +# for this bridge. +# bridge_cafile defines the path to a file containing the +# Certificate Authority certificates that have signed the remote broker +# certificate. +# bridge_capath defines a directory that will be searched for files containing +# the CA certificates. For bridge_capath to work correctly, the certificate +# files must have ".crt" as the file ending and you must run "openssl rehash +# " each time you add/remove a certificate. +#bridge_cafile +#bridge_capath + + +# If the remote broker has more than one protocol available on its port, e.g. +# MQTT and WebSockets, then use bridge_alpn to configure which protocol is +# requested. Note that WebSockets support for bridges is not yet available. +#bridge_alpn + +# When using certificate based encryption, bridge_insecure disables +# verification of the server hostname in the server certificate. This can be +# useful when testing initial server configurations, but makes it possible for +# a malicious third party to impersonate your server through DNS spoofing, for +# example. Use this option in testing only. If you need to resort to using this +# option in a production environment, your setup is at fault and there is no +# point using encryption. +#bridge_insecure false + +# Path to the PEM encoded client certificate, if required by the remote broker. +#bridge_certfile + +# Path to the PEM encoded client private key, if required by the remote broker. +#bridge_keyfile + +# ----------------------------------------------------------------- +# PSK based SSL/TLS support +# ----------------------------------------------------------------- +# Pre-shared-key encryption provides an alternative to certificate based +# encryption. A bridge can be configured to use PSK with the bridge_identity +# and bridge_psk options. These are the client PSK identity, and pre-shared-key +# in hexadecimal format with no "0x". Only one of certificate and PSK based +# encryption can be used on one +# bridge at once. +#bridge_identity +#bridge_psk + + +# ================================================================= +# External config files +# ================================================================= + +# External configuration files may be included by using the +# include_dir option. This defines a directory that will be searched +# for config files. All files that end in '.conf' will be loaded as +# a configuration file. It is best to have this as the last option +# in the main file. This option will only be processed from the main +# configuration file. The directory specified must not contain the +# main configuration file. +# Files within include_dir will be loaded sorted in case-sensitive +# alphabetical order, with capital letters ordered first. If this option is +# given multiple times, all of the files from the first instance will be +# processed before the next instance. See the man page for examples. +#include_dir diff --git a/IoTSonnenUploader/mosquitto/passwords b/IoTSonnenUploader/mosquitto/passwords new file mode 100644 index 0000000..da39feb --- /dev/null +++ b/IoTSonnenUploader/mosquitto/passwords @@ -0,0 +1 @@ +tims:$7$101$YbkgmQD38lY3nCX9$T1x2Ff3gDqK95E/ZBwV+R7f4D4RkpLNuhLm1Fv2gp9moz5xyGJRHRtnStrxSL26FreOvryLb/shoL0hAbVzFJw== diff --git a/IoTSonnenUploader/mvnw b/IoTSonnenUploader/mvnw new file mode 100644 index 0000000..8822887 --- /dev/null +++ b/IoTSonnenUploader/mvnw @@ -0,0 +1,287 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Apache Maven Wrapper startup batch script, version 3.1.1 +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /usr/local/etc/mavenrc ] ; then + . /usr/local/etc/mavenrc + fi + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + JAVA_HOME="`/usr/libexec/java_home`"; export JAVA_HOME + else + JAVA_HOME="/Library/Java/Home"; export JAVA_HOME + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`\\unset -f command; \\command -v java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + printf '%s' "$(cd "$basedir"; pwd)" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=$(find_maven_basedir "$(dirname $0)") +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}; export MAVEN_PROJECTBASEDIR +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + wrapperUrl="$MVNW_REPOURL/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + else + wrapperUrl="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) wrapperUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $wrapperUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + QUIET="--quiet" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + QUIET="" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget $QUIET "$wrapperUrl" -O "$wrapperJarPath" + else + wget $QUIET --http-user="$MVNW_USERNAME" --http-password="$MVNW_PASSWORD" "$wrapperUrl" -O "$wrapperJarPath" + fi + [ $? -eq 0 ] || rm -f "$wrapperJarPath" + elif command -v curl > /dev/null; then + QUIET="--silent" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + QUIET="" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl $QUIET -o "$wrapperJarPath" "$wrapperUrl" -f -L + else + curl $QUIET --user "$MVNW_USERNAME:$MVNW_PASSWORD" -o "$wrapperJarPath" "$wrapperUrl" -f -L + fi + [ $? -eq 0 ] || rm -f "$wrapperJarPath" + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaSource="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaSource=`cygpath --path --windows "$javaSource"` + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaSource" ]; then + if [ ! -e "$javaClass" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaSource") + fi + if [ -e "$javaClass" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + $MAVEN_DEBUG_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/IoTSonnenUploader/mvnw.bat b/IoTSonnenUploader/mvnw.bat new file mode 100644 index 0000000..1d7c59b --- /dev/null +++ b/IoTSonnenUploader/mvnw.bat @@ -0,0 +1,187 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Apache Maven Wrapper startup batch script, version 3.1.1 +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %* +if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %* +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set WRAPPER_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + +FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET WRAPPER_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET WRAPPER_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %WRAPPER_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%WRAPPER_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% ^ + %JVM_CONFIG_MAVEN_PROPS% ^ + %MAVEN_OPTS% ^ + %MAVEN_DEBUG_OPTS% ^ + -classpath %WRAPPER_JAR% ^ + "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^ + %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat" +if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%"=="on" pause + +if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE% + +cmd /C exit /B %ERROR_CODE% diff --git a/IoTSonnenUploader/pom.xml b/IoTSonnenUploader/pom.xml new file mode 100644 index 0000000..34dcea0 --- /dev/null +++ b/IoTSonnenUploader/pom.xml @@ -0,0 +1,211 @@ + + + + 4.0.0 + com.oracle.demo.timg.iot + iotsonnenuploader + 0.0.1 + ${packaging} + + + io.micronaut.platform + micronaut-parent + 4.10.1 + + + jar + 21 + 21 + 4.10.1 + false + com.oracle.demo.timg.iot.aot.generated + true + netty + com.oracle.demo.timg.iot.iotsonnenuploader.Application + 1.18.42 + + + + + central + https://repo.maven.apache.org/maven2 + + + + + + io.micronaut + micronaut-http-client + compile + + + + io.micronaut.mqtt + micronaut-mqtt-hivemq + + + + + io.micronaut.serde + micronaut-serde-jackson + compile + + + io.micronaut.validation + micronaut-validation + compile + + + jakarta.validation + jakarta.validation-api + compile + + + org.yaml + snakeyaml + runtime + + + ch.qos.logback + logback-classic + runtime + + + io.micronaut.testresources + micronaut-test-resources-client + provided + + + io.micronaut.test + micronaut-test-junit5 + test + + + org.junit.jupiter + junit-jupiter-api + test + + + org.junit.jupiter + junit-jupiter-engine + test + + + org.projectlombok + lombok + + + + + + + io.micronaut.maven + micronaut-maven-plugin + + true + aot-${packaging}.properties + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + org.apache.maven.plugins + maven-compiler-plugin + + + + + + + org.projectlombok + lombok + ${lombok.version} + + + io.micronaut + micronaut-inject-java + ${micronaut.core.version} + + + io.micronaut + micronaut-http-validation + ${micronaut.core.version} + + + io.micronaut.serde + micronaut-serde-processor + ${micronaut.serialization.version} + + + io.micronaut + micronaut-inject + + + + + io.micronaut.validation + micronaut-validation-processor + ${micronaut.validation.version} + + + io.micronaut + micronaut-inject + + + + + + -Amicronaut.processing.group=com.oracle.demo.timg.iot + -Amicronaut.processing.module=iotsonnenuploader + + + + + + + diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java new file mode 100644 index 0000000..c41c8fc --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java @@ -0,0 +1,10 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader; + +import io.micronaut.runtime.Micronaut; + +public class Application { + + public static void main(String[] args) { + Micronaut.run(Application.class, args); + } +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java new file mode 100644 index 0000000..0e18dba --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java @@ -0,0 +1,18 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.commanddata; + +import java.time.ZonedDateTime; + +import io.micronaut.serde.annotation.Serdeable; +import lombok.Builder; +import lombok.Data; + +@Serdeable +@Data +@Builder +public class CommandResponse { + private ZonedDateTime cmdReceived; + private ZonedDateTime cmdActioned; + private int cmdLength; + private boolean cmdStatus; + private String cmdResponse; +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java new file mode 100644 index 0000000..434a4d0 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java @@ -0,0 +1,22 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.micronaut.serde.annotation.Serdeable; +import lombok.Data; + +@Serdeable +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class SonnenConfiguration { + @JsonProperty("EM_USOC") + private int reservedBatteryCapacity; + @JsonProperty("EM_OperatingMode") + private int operatingMode; + @JsonProperty("EM_ToU_Schedule") + private String touSchedule; + @JsonProperty("DE_Software") + private String softwareVersion; + +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java new file mode 100644 index 0000000..03c8bb2 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java @@ -0,0 +1,30 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +import io.micronaut.serde.annotation.Serdeable; +import lombok.Data; + +@Serdeable +@Data +@JsonIgnoreProperties(ignoreUnknown = true) +public class SonnenStatus { + @JsonProperty("BackupBuffer") + private int reservedBatteryCapacity; + @JsonProperty("BatteryCharging") + private boolean batteryCharging; + @JsonProperty("BatteryDischarging") + private boolean batteryDischarging; + @JsonProperty("Consumption_Avg") + private int consumptionAvgLastMinute; + @JsonProperty("Consumption_W") + private int consumptionPointInTime; + @JsonProperty("GridFeedIn_W") + private int gridConsumption; + @JsonProperty("OperatingMode") + private int operatingMode; + @JsonProperty("Production_W") + private int solarProduction; + +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java new file mode 100644 index 0000000..1b947ba --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java @@ -0,0 +1,46 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; + +import java.io.IOException; +import java.time.ZonedDateTime; +import java.util.concurrent.CompletableFuture; + +import com.oracle.demo.timg.iot.iotsonnenuploader.commanddata.CommandResponse; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.mqtt.annotation.MqttSubscriber; +import io.micronaut.mqtt.annotation.Topic; +import io.micronaut.mqtt.annotation.v5.MqttProperties; +import io.micronaut.mqtt.annotation.v5.MqttProperty; +import io.micronaut.scheduling.TaskExecutors; +import io.micronaut.scheduling.annotation.ExecuteOn; +import io.micronaut.serde.ObjectMapper; +import jakarta.inject.Inject; +import lombok.extern.java.Log; + +@Log +@MqttSubscriber +@MqttProperties({ @MqttProperty(name = "username", value = "tims"), + @MqttProperty(name = "password", value = "ExamplePassword") }) +@Requires(property = MqttDeviceSettings.PREFIX + ".id") +public class MqttCommandHandler { + @Inject + public MqttCommandResponsePublisher responsePublisher; + @Inject + private ObjectMapper mapper; + + @ExecuteOn(TaskExecutors.IO) + @Topic("house/sonnen/command/${" + MqttDeviceSettings.PREFIX + ".id}") + public void receive(String command) throws IOException { + if (command.length() == 0) { + log.info("Monitor recieved zero length config"); + } + log.info("Recieved command " + command); + CommandResponse resp = CommandResponse.builder().cmdReceived(ZonedDateTime.now()) + .cmdActioned(ZonedDateTime.now().plusSeconds(5)).cmdLength(command.length()).cmdStatus(true) + .cmdResponse("Completed command " + command).build(); + log.info("Sending response " + resp); + String respString = mapper.writeValueAsString(resp); + CompletableFuture publishResp = responsePublisher.publishCommandResponse(respString.getBytes()); + publishResp.thenRun(() -> log.info("Sent response " + respString)); + } +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java new file mode 100644 index 0000000..9548ace --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java @@ -0,0 +1,17 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; + +import java.util.concurrent.CompletableFuture; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.mqtt.annotation.Topic; +import io.micronaut.mqtt.annotation.v5.MqttPublisher; +import io.micronaut.scheduling.TaskExecutors; +import io.micronaut.scheduling.annotation.ExecuteOn; + +@MqttPublisher +@Requires(property = MqttDeviceSettings.PREFIX + ".id") +public interface MqttCommandResponsePublisher { + @Topic("house/sonnen/commandresponse/${" + MqttDeviceSettings.PREFIX + ".id}") + @ExecuteOn(TaskExecutors.IO) + public CompletableFuture publishCommandResponse(byte[] responsebytes); +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java new file mode 100644 index 0000000..7bc0de8 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java @@ -0,0 +1,13 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; + +import io.micronaut.context.annotation.ConfigurationProperties; +import io.micronaut.context.annotation.Requires; +import lombok.Data; + +@ConfigurationProperties(MqttDeviceSettings.PREFIX) +@Requires(property = MqttDeviceSettings.PREFIX + ".id") +@Data +public class MqttDeviceSettings { + public static final String PREFIX = "mqtt.device"; + private String id; +} \ No newline at end of file diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java new file mode 100644 index 0000000..178c413 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java @@ -0,0 +1,24 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; + +import java.util.concurrent.CompletableFuture; + +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenConfiguration; +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenStatus; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.mqtt.annotation.Topic; +import io.micronaut.mqtt.annotation.v5.MqttPublisher; +import io.micronaut.scheduling.TaskExecutors; +import io.micronaut.scheduling.annotation.ExecuteOn; + +@MqttPublisher +@Requires(property = MqttDeviceSettings.PREFIX + ".id") +public interface MqttSonnenBatteryPublisher { + @Topic("house/sonnen/configuration/${" + MqttDeviceSettings.PREFIX + ".id}") + @ExecuteOn(TaskExecutors.IO) + public CompletableFuture publishSonnenConfiguration(SonnenConfiguration data); + + @Topic("house/sonnen/status/${" + MqttDeviceSettings.PREFIX + ".id}") + @ExecuteOn(TaskExecutors.IO) + public CompletableFuture publishSonnenStatus(SonnenStatus data); +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java new file mode 100644 index 0000000..a48c8c6 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java @@ -0,0 +1,24 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; + +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenConfiguration; +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenStatus; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.mqtt.annotation.MqttSubscriber; +import io.micronaut.mqtt.annotation.Topic; +import lombok.extern.java.Log; + +@Log +@MqttSubscriber +@Requires(property = MqttDeviceSettings.PREFIX + ".id") +public class MqttUploadMonitor { + @Topic("house/sonnen/configuration/${" + MqttDeviceSettings.PREFIX + ".id}") + public void receiveConfig(SonnenConfiguration config) { + log.info("Monitor recieved config " + config); + } + + @Topic("house/sonnen/status/${" + MqttDeviceSettings.PREFIX + ".id}") + public void receiveStatus(SonnenStatus status) { + log.info("Monitor recieved status " + status); + } +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java new file mode 100644 index 0000000..9a29827 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java @@ -0,0 +1,26 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; + +import static io.micronaut.http.HttpHeaders.ACCEPT; +import static io.micronaut.http.HttpHeaders.USER_AGENT; + +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenConfiguration; +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenStatus; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.http.annotation.Get; +import io.micronaut.http.annotation.Header; +import io.micronaut.http.client.annotation.Client; + +@Client(id = "sonnenbattery", path = "/api/v2") +@Header(name = USER_AGENT, value = "Micronaut HTTP Client") +@Header(name = ACCEPT, value = "application/json") +@Requires(property = SonnenBatteryHttpClientSettings.PREFIX + ".authToken") +public interface SonnenBatteryClient { + + @Get("/configurations") + public SonnenConfiguration fetchConfiguration(); + + @Get("/status") + public SonnenStatus fetchStatus(); + +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java new file mode 100644 index 0000000..5be9414 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java @@ -0,0 +1,13 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; + +import io.micronaut.context.annotation.ConfigurationProperties; +import io.micronaut.context.annotation.Requires; +import lombok.Data; + +@ConfigurationProperties(SonnenBatteryHttpClientSettings.PREFIX) +@Requires(property = SonnenBatteryHttpClientSettings.PREFIX + ".authToken") +@Data +public class SonnenBatteryHttpClientSettings { + public static final String PREFIX = "sonnenbattery"; + private String authToken; +} \ No newline at end of file diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java new file mode 100644 index 0000000..8a3c3e5 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java @@ -0,0 +1,27 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; + +import io.micronaut.context.annotation.Requires; +import io.micronaut.http.MutableHttpRequest; +import io.micronaut.http.annotation.ClientFilter; +import io.micronaut.http.annotation.RequestFilter; +import jakarta.inject.Inject; +import lombok.extern.java.Log; + +@ClientFilter(patterns = "/api/**") +@Requires(property = SonnenBatteryHttpClientSettings.PREFIX + ".authToken") +@Log +public class SonnenBatteryRequestFilter { + public final static String HEADER_AUTH_TOKEN = "Auth-Token"; + private final SonnenBatteryHttpClientSettings clientSettings; + + @Inject + public SonnenBatteryRequestFilter(SonnenBatteryHttpClientSettings clientSettings) { + this.clientSettings = clientSettings; + } + + @RequestFilter + public void doFilter(MutableHttpRequest request) { + log.finer("Adding header " + HEADER_AUTH_TOKEN); + request.getHeaders().add(HEADER_AUTH_TOKEN, clientSettings.getAuthToken()); + } +} \ No newline at end of file diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java new file mode 100644 index 0000000..9136332 --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java @@ -0,0 +1,51 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.uploader; + +import java.util.concurrent.CompletableFuture; + +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenConfiguration; +import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenStatus; +import com.oracle.demo.timg.iot.iotsonnenuploader.mqtt.MqttSonnenBatteryPublisher; +import com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller.SonnenBatteryClient; + +import io.micronaut.context.event.StartupEvent; +import io.micronaut.runtime.event.annotation.EventListener; +import io.micronaut.scheduling.TaskExecutors; +import io.micronaut.scheduling.annotation.ExecuteOn; +import io.micronaut.scheduling.annotation.Scheduled; +import jakarta.inject.Inject; +import jakarta.inject.Singleton; +import lombok.extern.java.Log; + +@Log +@Singleton +public class Uploader { + @Inject + private SonnenBatteryClient client; + @Inject + private MqttSonnenBatteryPublisher mqttSonnenBatteryPublisher; + + @Scheduled(fixedRate = "120s", initialDelay = "5s") + @ExecuteOn(TaskExecutors.IO) + public SonnenConfiguration processConfiguration() { + SonnenConfiguration conf = client.fetchConfiguration(); + log.info("Retrieved configuration from battery : " + conf); + CompletableFuture publishResp = mqttSonnenBatteryPublisher.publishSonnenConfiguration(conf); + publishResp.thenRun(() -> log.info("Published configuration as object")); + return conf; + } + + @Scheduled(fixedRate = "10s", initialDelay = "10s") + @ExecuteOn(TaskExecutors.IO) + public SonnenStatus processStatus() { + SonnenStatus status = client.fetchStatus(); + log.info("Retrieved status from battery : " + status); + CompletableFuture publishResp = mqttSonnenBatteryPublisher.publishSonnenStatus(status); + publishResp.thenRun(() -> log.info("Published status as object")); + return status; + } + + @EventListener + public void onStartup(StartupEvent event) { + log.info("Startup event received"); + } +} diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java new file mode 100644 index 0000000..502d86c --- /dev/null +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java @@ -0,0 +1,26 @@ +package com.oracle.demo.timg.iot.iotsonnenuploader.utils; + +import java.nio.charset.StandardCharsets; +import java.util.Base64; + +public class PasswordConverter { + public static void main(String[] args) { + for (int i = 0; i < args.length; i++) { + byte[] argBytes = args[i].getBytes(); + String argBytesString = ""; + for (int j = 0; j < argBytes.length; j++) { + if (j > 0) { + argBytesString += ","; + } + argBytesString += argBytes[j]; + } + // String b64 = + // Base64.getEncoder().encodeToString(args[i].getBytes(StandardCharsets.UTF_8)); + String b64 = new String(Base64.getEncoder().encode(args[i].getBytes(StandardCharsets.UTF_8)), + StandardCharsets.UTF_8); + System.out.println("Arg[" + i + "] has value " + args[i] + " as bytes " + args[i].getBytes() + + ", as byte array " + argBytesString + ", as base 64 " + b64); + } + } + +} diff --git a/IoTSonnenUploader/src/main/resources/logback.xml b/IoTSonnenUploader/src/main/resources/logback.xml new file mode 100644 index 0000000..2d77bda --- /dev/null +++ b/IoTSonnenUploader/src/main/resources/logback.xml @@ -0,0 +1,14 @@ + + + + + + %cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n + + + + + + + From 803fc4ce5a0de248978da269985d50b73aa23415 Mon Sep 17 00:00:00 2001 From: tim_graves <28924492+atimgraves@users.noreply.github.com> Date: Wed, 12 Nov 2025 18:23:54 +0000 Subject: [PATCH 2/2] added copyright statements to Java code --- .../iot/iotsonnenuploader/Application.java | 36 +++++++++++++++++++ .../commanddata/CommandResponse.java | 36 +++++++++++++++++++ .../incommingdata/SonnenConfiguration.java | 36 +++++++++++++++++++ .../incommingdata/SonnenStatus.java | 36 +++++++++++++++++++ .../mqtt/MqttCommandHandler.java | 36 +++++++++++++++++++ .../mqtt/MqttCommandResponsePublisher.java | 36 +++++++++++++++++++ .../mqtt/MqttDeviceSettings.java | 36 +++++++++++++++++++ .../mqtt/MqttSonnenBatteryPublisher.java | 36 +++++++++++++++++++ .../mqtt/MqttUploadMonitor.java | 36 +++++++++++++++++++ .../sonnencontroller/SonnenBatteryClient.java | 36 +++++++++++++++++++ .../SonnenBatteryHttpClientSettings.java | 36 +++++++++++++++++++ .../SonnenBatteryRequestFilter.java | 36 +++++++++++++++++++ .../iotsonnenuploader/uploader/Uploader.java | 36 +++++++++++++++++++ .../utils/PasswordConverter.java | 36 +++++++++++++++++++ 14 files changed, 504 insertions(+) diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java index c41c8fc..f4ba858 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/Application.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader; import io.micronaut.runtime.Micronaut; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java index 0e18dba..943c584 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/commanddata/CommandResponse.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.commanddata; import java.time.ZonedDateTime; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java index 434a4d0..2ae8b55 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenConfiguration.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java index 03c8bb2..d9c1ba4 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/incommingdata/SonnenStatus.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java index 1b947ba..ce852c0 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandHandler.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; import java.io.IOException; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java index 9548ace..4aa6abc 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttCommandResponsePublisher.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; import java.util.concurrent.CompletableFuture; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java index 7bc0de8..455784c 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttDeviceSettings.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; import io.micronaut.context.annotation.ConfigurationProperties; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java index 178c413..3eebc27 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttSonnenBatteryPublisher.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; import java.util.concurrent.CompletableFuture; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java index a48c8c6..5a883de 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/mqtt/MqttUploadMonitor.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.mqtt; import com.oracle.demo.timg.iot.iotsonnenuploader.incommingdata.SonnenConfiguration; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java index 9a29827..ee5b3fc 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryClient.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; import static io.micronaut.http.HttpHeaders.ACCEPT; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java index 5be9414..98ec784 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryHttpClientSettings.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; import io.micronaut.context.annotation.ConfigurationProperties; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java index 8a3c3e5..f60ab7e 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/sonnencontroller/SonnenBatteryRequestFilter.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.sonnencontroller; import io.micronaut.context.annotation.Requires; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java index 9136332..1224c34 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/uploader/Uploader.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.uploader; import java.util.concurrent.CompletableFuture; diff --git a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java index 502d86c..46af848 100644 --- a/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java +++ b/IoTSonnenUploader/src/main/java/com/oracle/demo/timg/iot/iotsonnenuploader/utils/PasswordConverter.java @@ -1,3 +1,39 @@ +/*Copyright (c) 2025 Oracle and/or its affiliates. + +The Universal Permissive License (UPL), Version 1.0 + +Subject to the condition set forth below, permission is hereby granted to any +person obtaining a copy of this software, associated documentation and/or data +(collectively the "Software"), free of charge and under any and all copyright +rights in the Software, and any and all patent rights owned or freely +licensable by each licensor hereunder covering either (i) the unmodified +Software as contributed to or provided by such licensor, or (ii) the Larger +Works (as defined below), to deal in both + +(a) the Software, and +(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +one is included with the Software (each a "Larger Work" to which the Software +is contributed by such licensors), + +without restriction, including without limitation the rights to copy, create +derivative works of, display, perform, and distribute the Software and make, +use, sell, offer for sale, import, export, have made, and have sold the +Software and the Larger Work(s), and to sublicense the foregoing rights on +either these or other terms. + +This license is subject to the following condition: +The above copyright notice and either this complete permission notice or at +a minimum a reference to the UPL must be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + */ package com.oracle.demo.timg.iot.iotsonnenuploader.utils; import java.nio.charset.StandardCharsets;