Skip to content

Commit 688fb22

Browse files
committed
added minor text changes to the various example files and tidied up som
other elements, added sample DB connect string and examples of how to build the test worker for JDBC access
1 parent 78c4c4c commit 688fb22

7 files changed

Lines changed: 189 additions & 5 deletions

IoTSonnenUploader/DigitalTwin/Instructions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
All examples below use the default oci config entry
23
Make sure you have the latest OCI command line client 3.70.1 works as may earlier versions, but 3.45 does not. On Macos you can use homebrew - https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/cliinstall.htm#InstallingCLI__macos_homebrew other instrucitons are at - see https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/climanualinst.htm
34

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"@context": [
3+
"dtmi:dtdl:context;3",
4+
"dtmi:dtdl:extension:historization;1",
5+
"dtmi:dtdl:extension:quantitativeTypes;1",
6+
"dtmi:com:oracle:dtdl:extension:validation;1"
7+
],
8+
"@id": "dtmi:com:oracle:demo:timg:iot:homebattery;1",
9+
"@type": "Interface",
10+
"contents": [
11+
{
12+
"@type": [
13+
"Telemetry",
14+
"Historized"
15+
],
16+
"displayName": "Battery Operating Mode",
17+
"name": "OperatingMode",
18+
"schema": "string"
19+
},
20+
{
21+
"@type": [
22+
"Telemetry",
23+
"Historized",
24+
"Validated"
25+
],
26+
"displayName": "Current Battery Charge Percentage",
27+
"name": "CurrentChargePercentage",
28+
"schema": "integer",
29+
"minimum": 0,
30+
"maximum": 100
31+
},
32+
{
33+
"@type": [
34+
"Telemetry",
35+
"Historized",
36+
"Validated"
37+
],
38+
"displayName": "Reserved Battery Charge Percentage",
39+
"name": "ReservedChargePercentage",
40+
"schema": "integer",
41+
"minimum": 0,
42+
"maximum": 100
43+
},
44+
{
45+
"@type": [
46+
"Telemetry",
47+
"Historized"
48+
],
49+
"displayName": "Battery Is Charging",
50+
"name": "BatteryCharging",
51+
"schema": "boolean"
52+
},
53+
{
54+
"@type": [
55+
"Telemetry",
56+
"Historized",
57+
"EnergyRate"
58+
],
59+
"displayName": "Battery Power Supplied 1 min average",
60+
"name": "DischargeRateAvgLastMinute",
61+
"schema": "integer",
62+
"unit": "watt"
63+
},
64+
{
65+
"@type": [
66+
"Telemetry",
67+
"Historized",
68+
"EnergyRate"
69+
],
70+
"displayName": "Solar Power Production Point In Time",
71+
"name": "SolarGeneration",
72+
"schema": "integer",
73+
"unit": "watt"
74+
},
75+
{
76+
"@type": [
77+
"Telemetry"
78+
],
79+
"displayName": "Software Version",
80+
"name": "SoftwareVersion",
81+
"schema": "string"
82+
}
83+
]
84+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"reference-endpoint": "house/sonnenstatus",
3+
"reference-payload": {
4+
"data": {
5+
"batteryCharging": false,
6+
"consumptionAvgWattsLastMinute": 0,
7+
"currentBatteryCapacityPercentage": 0,
8+
"operatingMode": 0,
9+
"reservedBatteryCapacityPercentage": 0,
10+
"solarProductionWattsPointInTime": 0,
11+
"time": 123456
12+
},
13+
"data-format": "JSON"
14+
},
15+
"envelope-mapping": {
16+
"timeObserved": "$.time"
17+
}
18+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[
2+
{
3+
"condition": "${endpoint(1) == \"house\" and endpoint(2) == \"sonnenstatus\"}",
4+
"description": "Handle status messages",
5+
"reference-payload": {
6+
"dataFormat": "JSON",
7+
"data": {
8+
"batteryCharging": false,
9+
"consumptionAvgWattsLastMinute": 339,
10+
"currentBatteryCapacityPercentage": 59,
11+
"operatingMode": 2,
12+
"reservedBatteryCapacityPercentage": 5,
13+
"solarProductionWattsPointInTime": 131,
14+
"time": 1763981430279
15+
}
16+
},
17+
"payload-mapping": {
18+
"$.BatteryCharging": "$.batteryCharging",
19+
"$.DischargeRateAvgLastMinute": "$.consumptionAvgWattsLastMinute",
20+
"$.CurrentChargePercentage": "$.currentBatteryCapacityPercentage",
21+
"$.OperatingMode": "${if (.operatingMode == 1) then \"Manual\" elif (.operatingMode == 2) then \"Automatic - Self-Consumption\" elif (.operatingMode == 6) then \"Battery-Module-Extension (30%)\" elif (.operatingMode == 10) then \"Time-Of-Use\" else \"Unknown Mode\" end}",
22+
"$.ReservedChargePercentage": "$.reservedBatteryCapacityPercentage",
23+
"$.SolarGeneration": "$.solarProductionWattsPointInTime"
24+
}
25+
},
26+
{
27+
"condition": "${endpoint(1) == \"house\" and endpoint(2) == \"sonnenconfiguration\"}",
28+
"description": "Handle configuration messages",
29+
"reference-payload": {
30+
"dataFormat": "JSON",
31+
"data": {
32+
"softwareVersion": "1.18.4",
33+
"time": 1764004099418
34+
}
35+
},
36+
"payload-mapping": {
37+
"$.SoftwareVersion": "$.softwareVersion"
38+
}
39+
}
40+
]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"condition": "${endpoint(1) == \"house\" and endpoint(2) == \"sonnenstatus\"}",
4+
"description": "Default condition",
5+
"payload-mapping": {
6+
"$.BatteryCharging": "$.batteryCharging",
7+
"$.BatteryDischarging": "$.batteryDischarging",
8+
"$.DischargeRateAvgLastMinute": "$.consumptionAvgWattsLastMinute",
9+
"$.DischargePower": "$.consumptionWattsPointInTime",
10+
"$.CurrentChargePercentage": "$.currentBatteryCapacityPercentage",
11+
"$.GridFlowPointInTime": "$.gridConsumptionWattsPointInTime",
12+
"$.OperatingMode": "${if (.operatingMode == 1) then \"Manual\" elif (.operatingMode == 2) then \"Automatic - Self-Consumption\" elif (.operatingMode == 6) then \"Battery-Module-Extension (30%)\" elif (.operatingMode == 10) then \"Time-Of-Use\" else \"Unknown Mode\" end}",
13+
"$.CapacityRemaining": "$.remainingBatteryCapacityWattHours",
14+
"$.ReservedChargePercentage": "$.reservedBatteryCapacityPercentage",
15+
"$.SolarGeneration": "$.solarProductionWattsPointInTime",
16+
"$.InverterPowerWattsPointInTime": "$.inverterPowerWattsPointInTime",
17+
"$.StatusTimestamp": "$.timestamp"
18+
},
19+
"reference-payload": {
20+
"dataFormat": "JSON",
21+
"data": {
22+
"consumptionAvgWattsLastMinute": 339,
23+
"consumptionWattsPointInTime": 333,
24+
"currentBatteryCapacityPercentage": 59,
25+
"currentBatteryCapacitySystemPercentage": 62,
26+
"gridConsumptionWattsPointInTime": 41,
27+
"operatingMode": 2,
28+
"remainingBatteryCapacityWattHours": 9102,
29+
"reservedBatteryCapacityPercentage": 5,
30+
"solarProductionWattsPointInTime": 131,
31+
"time": 1763981430279,
32+
"timestamp": "2025-11-24T10:50:30.279369Z[Europe/London]",
33+
"batteryCharging": false,
34+
"batteryDischarging": true,
35+
"inverterPowerWattsPointInTime": 42
36+
}
37+
}
38+
}
39+
]

IoTSonnenUploader/OCISetup/IoTCacheDBConnect.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
(port=1521)
77
(host=adb.uk-london-1.oraclecloud.com)
88
)
9-
(connect_data=(service_name=g896eaa614b05d8_zgadzmoftnvhy_low.adb.oraclecloud.com))
9+
(connect_data=(service_name=<domain group id>_<domain id>_low.adb.oraclecloud.com))
1010
(security=
1111
(ssl_server_dn_match=yes)
1212
(password_auth=OCI_TOKEN)
1313
(oci_iam_url=https://auth.uk-london-1.oraclecloud.com/v1/actions/generateScopedAccessBearerToken)
14-
(oci_tenancy=ocid1.tenancy.oc1..aaaaaaaa4wptnxymnypvjjltnejidchjhz6uimlhru7rdi5qb6qlnmrtgu3a)
15-
(oci_compartment=ocid1.compartment.oc1..aaaaaaaakepwnl3nox7xbfxmw5j6f742vhf5aoccoo6iknq5ttzww4njrf2q)
14+
(oci_tenancy=<tenancy ocid>)
15+
(oci_compartment=<compartment ocid>)
1616
)
1717
)

IoTSonnenUploader/OCISetup/SQLDBAccessClientSetupVM.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
once VM is in place and you're connected using the bastion
1+
Setup a Linux instance VM connected to the VCN as per the IoT setup (be sure to enable the basion agent)
2+
3+
once VM is in place and you're connected using the bastion (The CreatebastionSession.sh can set this up for you)
24
install java and maven to allow for compilation as well as the sqlcl command
35
we also need git to get the code itself
46
sudo dnf install java-21-openjdk-devel --assumeyes
@@ -17,7 +19,7 @@ remove the retry info and add the token name if using the sqlcl from above (or a
1719

1820
./bin/sql /@"jdbc:oracle:thin:@tcps:adb.uk-london-1.oraclecloud.com:1521/<stuff>_low.adb.oraclecloud.com?TOKEN_AUTH=OCI_TOKEN"
1921

20-
in the sql you ae in the domain group (__WKSP) schema, you want to be in the __IOT one to manage the data otherwise yoiu have to prefix the iot schema name to every table.
22+
in the sql you are in the domain group (__WKSP) schema, you want to be in the __IOT one to manage the data otherwise you will have to prefix the iot schema name to every table.
2123
alter session set current_schema=<Iot domain short id>__iot
2224
e.g.
2325
alter session set current_schema=yieh4avra3mt2__iot

0 commit comments

Comments
 (0)