Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
237 changes: 237 additions & 0 deletions IoTDemoProxyGateway/README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion IoTDemoProxyGateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.oracle.demo.timg.iot.iotproxygateway</groupId>
<artifactId>IoTDemoProxyGateway</artifactId>
<version>0.1</version>
<version>2.0.0</version>
<packaging>${packaging}</packaging>

<parent>
Expand Down
8 changes: 4 additions & 4 deletions IoTDemoProxyGateway/sampleconfig/gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ gateway:
entitiessubpath: "entities"
config:
enabled: true
publishrate: "3600s"
initialdelay: "10s"
publishrate: "1200s"
initialdelay: "5s"
stats:
enabled: true
publishrate: "600s"
initialdelay: "5s"
publishrate: "60s"
initialdelay: "60s"
11 changes: 5 additions & 6 deletions IoTDemoProxyGateway/sampleconfig/homeassistant.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
home-assistant:
api:
auth_token: "<your HA token>"
port: <Your HA port, might be 80 or 8123>
host: <Your HA servers IP address, sometimes homeassistant.local will work>
api:
port: 8123
host: <your home assistant IP or hostname>
protocol: "http"
url: ${home-assistant.api.protocol}://${home-assistant.api.host}:${home-assistant.api.port}
monitored-entities:
monitored-entity-sets:
- name: "HomeBatteryManualReserve"
doupload: true
initaldelay: "PT3s"
Expand Down Expand Up @@ -348,7 +347,7 @@ home-assistant:
endpoint: "airqualityruuvi"
monitoredentities:
- name: "Lounge Air Quality Score"
entityid: "sensor.ruuvi_air_3ee7_indoor_air_quality_score"
entityid: "sensor.ruuvi_air_lounge_indoor_air_quality_score"
iottype: "NUMBER"
fieldname: "qualityscore"
sendmode: "ALWAYS"
Expand Down
1 change: 1 addition & 0 deletions IoTDemoProxyGateway/sampleconfig/mqtt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mqtt:
#protocol: tcp
protocol: ssl
client:
# replaced with output mode enabled: true
# Unique identifier for this MQTT client
# The gateway name, not any device name
client-id: ${gateway.identity.name}
Expand Down
4 changes: 3 additions & 1 deletion IoTDemoProxyGateway/sampleconfig/operatingmodes.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
# options are HOME_ASSISTANT, REPLAY, NONE - see the OperatingModeInput class
# default is HOME_ASSISTANT
operatingmodes.inputmode=HOME_ASSISTANT
#operatingmodes.inputmode=REPLAY
# this controls where data is sent to - written to a file for later replay or uploaded using MQTT to the IoT service
# options are RECORDER, MQTT, NONE - see the OperatingModeOutput class
# default is MQTT
operatingmodes.outputmode=MQTT
operatingmodes.outputmode=RECORDER
#operatingmodes.outputmode=MQTT
# the following combinations will do something useful
# HOME_ASSISTANT to MQTT
# HOME_ASSISTANT to RECORDER
Expand Down
4 changes: 3 additions & 1 deletion IoTDemoProxyGateway/sampleconfig/record.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# replaced with operatingmodes.outputmode record.enabled=false
record.output.file=recordeddata.txt
record.output.directory=savedata
record.output.prefixwithdtg=true
record.duration=2H
record.duration=4h
#record.startat=2026-09-28T00-00-01.000000Z
6 changes: 3 additions & 3 deletions IoTDemoProxyGateway/sampleconfig/replay.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
replay.inputfile=savedata/2026-08-20T13-26-41.313315-recordeddata.txt
replay.inputfile=savedata/2026-08-25T15-43-05.034887Z-recordeddata.txt
replay.replayStartOffset=0s
replay.highspeed.duration=10s
replay.highspeed.duration=0s
replay.highspeed.delay=1ms
replay.realtime.duration=0s
replay.realtime.duration=110s
3 changes: 0 additions & 3 deletions IoTDemoProxyGateway/sampleconfigsecure/configsecure.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
home-assistant:
api:
auth_token: "<Your home assistant auth token, go to your profile in HA, then security tab, then long-lived access tokens - see HA documentaion "
6 changes: 6 additions & 0 deletions IoTDemoProxyGateway/sampleconfigsecure/iotsecure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
private:
devicehost: "vc3vlnfuwezrc.device.iot.uk-london-1.oci.oraclecloud.com"
mqtt:
client:
brokeroracle: ${private.devicehost}
passwordoracle: "ImAnI0TS3cr3tD0ntShar3M3"
6 changes: 0 additions & 6 deletions IoTDemoProxyGateway/sampleconfigsecure/private-settings.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class PropertyNames {
public final static String RECORD_OUTPUT_DIRECTORY_DEFAULT = "saved";
public final static String RECORD_OUTPUT_PREFIX_WITH_DTG = RECORD_OUTPUT + ".prefixwithdtg";
public final static String RECORD_DURATION = "record.duration";
public final static String RECORD_START_AT = "record.startat";
public final static String RECORD_EXIT_AFTER_RECORDING_STOP = "record.exitafterrecordingstop";

// these properties are the mqtt settings for uploading events (live or
Expand Down Expand Up @@ -103,7 +104,7 @@ public class PropertyNames {
// property names to retrieve info from the home assistant instance for live
// upload or recording.
public final static String HOME_ASSISTANT = "home-assistant";
public final static String HOME_ASSISTANT_MONITORED_ENTITIES_LIST = HOME_ASSISTANT + ".monitored-entities";
public final static String HOME_ASSISTANT_MONITORED_ENTITY_SETS_LIST = HOME_ASSISTANT + ".monitored-entity-sets";
public final static String HOME_ASSISTANT_API = HOME_ASSISTANT + ".api";
public final static String HOME_ASSISTANT_API_AUTH_TOKEN = HOME_ASSISTANT_API + ".auth_token";
public final static String HOME_ASSISTANT_API_PROTOCOL = HOME_ASSISTANT_API + ".protocol";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
/*Copyright (c) 2026 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.iotproxygateway.inputs;

public enum OperatingModeInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void postConstruct() {
/*
* have this use the micronaut scheduler, it's easier
*/
@Scheduled(fixedRate = "${" + PropertyNames.GATEWAY_CONFIG + ":1200s}", initialDelay = "${"
@Scheduled(fixedRate = "${" + PropertyNames.GATEWAY_CONFIG_PUBLISH_RATE + ":1200s}", initialDelay = "${"
+ PropertyNames.GATEWAY_CONFIG_INITIAL_DELAY + ":5s}")
@ExecuteOn(TaskExecutors.IO)
public void processConfiguration() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
/*Copyright (c) 2026 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.iotproxygateway.inputs.homeassistant;

public enum HomeAssistantEntityRetrieveStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Software and the Larger Work(s), and to sublicense the foregoing rights on
@Data
@NoArgsConstructor
@Log
@EachProperty(value = PropertyNames.HOME_ASSISTANT_MONITORED_ENTITIES_LIST, primary = "name", list = true)
@EachProperty(value = PropertyNames.HOME_ASSISTANT_MONITORED_ENTITY_SETS_LIST, primary = "name", list = true)
public class HomeAssistantMonitoredEntitySet implements Runnable {
// get the UTC TZ once to speed things later
private final static ZoneId UTC_TZ = ZoneId.of("UTC");
Expand All @@ -76,12 +76,12 @@ public class HomeAssistantMonitoredEntitySet implements Runnable {
private final static HomeAssistantState EPOCH_HA_STATE = HomeAssistantState.builder().last_changed(EPOCH_TIME)
.last_reported(EPOCH_TIME).last_updated(EPOCH_TIME).build();
private String name;
private Boolean doupload;
private Boolean doupload = true;
private Duration initaldelay = Duration.ofSeconds(5);
private Duration retrievalrate = Duration.ofSeconds(10);
private String devicekey;
private String endpoint;
private TimestampMode timestampMode = TimestampMode.LATEST;
private TimestampMode timestampmode = TimestampMode.LATEST;
private List<HomeAssistantMonitoredEntity> monitoredentities;
@ToString.Exclude
@Inject
Expand Down Expand Up @@ -166,7 +166,7 @@ private ZonedDateTime processEntities(Map<String, Object> payload) {
instant.getNano() / 1_000);
});
// based on our comparison type calculate the actual microseconds value
Long sortedTsOpt = switch (timestampMode) {
Long sortedTsOpt = switch (timestampmode) {
case AVERAGE -> Math.round(entityTimeAsLong.average().orElse(0));
case EARLIEST -> entityTimeAsLong.min().orElse(0);
case LATEST -> entityTimeAsLong.max().orElse(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*Copyright (c) 2025 Oracle and/or its affiliates.
/*Copyright (c) 2026 Oracle and/or its affiliates.

The Universal Permissive License (UPL), Version 1.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
/*Copyright (c) 2026 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.iotproxygateway.outputs;

import java.util.concurrent.CompletableFuture;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
/*Copyright (c) 2026 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.iotproxygateway.outputs;

public enum OperatingModeOutput {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*Copyright (c) 2025 Oracle and/or its affiliates.
/*Copyright (c) 2026 Oracle and/or its affiliates.

The Universal Permissive License (UPL), Version 1.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
/*Copyright (c) 2026 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.iotproxygateway.outputs.none;

import java.util.concurrent.CompletableFuture;
Expand Down
Loading