Compare commits

...

868 Commits

Author SHA1 Message Date
Gunnar Skjold
c49ff9f3ec Allow up to 8 cycles to charge capacitor 2026-02-27 09:06:19 +01:00
Gunnar Skjold
ae473cab20 Moved reset of reboot reason to main program 2026-02-27 08:55:10 +01:00
Gunnar Skjold
0b4884652f Allow for more errors during upgrade (#1139)
* Allow for more errors during upgrade

* More instead of equals
2026-02-12 12:28:31 +01:00
Gunnar Skjold
82aeae8699 Fixed compile error for 8266 after #1121 (#1138) 2026-02-12 09:45:04 +01:00
Gunnar Skjold
a7333653b0 Fixed decimal accuracy on saved values (#1133) 2026-02-12 08:25:32 +01:00
Gunnar Skjold
24e63d5e32 Fixed HA object id (#1132) 2026-02-12 08:25:17 +01:00
Gunnar Skjold
eb7c266378 Fixed double slash on Wiki links (#1123) 2026-02-12 08:25:04 +01:00
Gunnar Skjold
cf8c48ab99 Added code to ensure stable boot (#1121)
* If BUS powered, wait for capacitor to charge on boot, this ensures better boot stability

* Some cleanup
2026-02-12 08:24:50 +01:00
Gunnar Skjold
78a1cd78ea Added support for a new format for a Iskra meter in Switzerland (#1118) 2026-02-12 08:24:26 +01:00
Gunnar Skjold
fdfa6c1b52 Fixed MQTT JSON for prices (#1116) 2026-01-01 20:07:48 +01:00
Gunnar Skjold
4f1790a464 Added support for Iskraemeco IE.5 in Croatia (#1107)
* Added support for Croation Iskra

* Temp removed meterid

* Fixed HDLC block decoding

* Fixed context length

* Changing some stuff back

* Change some stuff back

* Final test

* Added debugging

* Updated selector for iskra dataformat

* Added fake test frame
2025-12-30 10:12:31 +01:00
Gunnar Skjold
ca4cef5233 Fixed empty timestamp in Home-Assistant JSON (#1105)
* Nullable timestamps for HA JSON

* Nullable timestamps for MQTT JSON
2025-12-30 10:05:39 +01:00
Gunnar Skjold
a0d7fd0d95 Fixed extraction of negative prices from server (#1104) 2025-12-30 10:04:55 +01:00
Gunnar Skjold
489dbf9254 Fixed IPv6 formatting (#1106) 2025-12-30 10:04:30 +01:00
Gunnar Skjold
a81aa11558 Added support for frames without checksum (#1108) 2025-12-29 13:25:36 +01:00
Gunnar Skjold
2e4a0fc0a3 Fixed price shift for non-CET price area (#1090)
* Fixed non-CET price presentation

* Added compiled version

* Updated fix for non cet

* Fixed! I think...
2025-12-11 11:42:17 +01:00
Gunnar Skjold
fc6e9e8085 Fixed ESP8266 memory issue with price decoding (#1089) 2025-12-11 11:37:52 +01:00
Gunnar Skjold
ad73821f1c Disable auto buffer size for HAN on ESP8266 (#1086) 2025-12-11 11:34:46 +01:00
Gunnar Skjold
98bf5b958f Fixed float infinity issue (#1087) 2025-12-11 11:34:15 +01:00
Gunnar Skjold
f323c5a4f6 Fixed building without remote debug (#1084) 2025-12-09 12:19:00 +01:00
Gunnar Skjold
ea91248e67 Changed MQTT client timeout setting for ESP8266 (#1077) 2025-12-05 15:37:23 +01:00
Gunnar Skjold
271ce2081f Fixed reboot loop for some meters (#1075) 2025-12-05 10:02:59 +01:00
Gunnar Skjold
8438020dbd Feature: Dump hex data from meter to MQTT (#1071)
* Send raw data debug to MQTT

* Publish hexdump to /data

* Sensor for /data, but it doesnt work
2025-12-01 14:02:07 +01:00
Gunnar Skjold
9252a810df Improve power stability when using MQTT (#1070)
* Changes to improve MQTT and power stability

* Re-added the memory leak fix

* Re-added the memory leak fix

* Stop client before deleting

* Fixed potential nullpointer
2025-12-01 10:01:20 +01:00
Gunnar Skjold
c0c696a55c Fixed default MQTT subscription (#1065) 2025-11-27 09:37:06 +01:00
Gunnar Skjold
ef70d39f70 Fixed what hours the fixed price is applied to (#1069) 2025-11-27 09:36:10 +01:00
Gunnar Skjold
1cf890dc26 Improvements for 2.5.0-rc3 (#1064)
* Various changes for 2.5.0-rc3

* Changed to official amsleser wiki
2025-11-21 12:40:13 +01:00
Gunnar Skjold
9d307e3192 Fixed premature cut on version string if release candidate (#1061) 2025-11-21 08:22:55 +01:00
Gunnar Skjold
61f0356a10 Added option to select firmware channel (#1060) 2025-11-13 15:14:52 +01:00
Gunnar Skjold
c648546b61 Added support for 15 minute price resolution (#1031)
* 15min prices WIP

* WIP more changes for 15min prices

* More work on 15min pricing

* Fixed some errors

* Some changes after testing

* Graphical changes for 15min pricing

* Adjustments on MQTT handlers after switching to 15min prices

* Reverted some MQTT changes

* Adapted HA integration for 15min pricing

* Adapted JSON payload for 15min

* Adjustments during testing

* Set default price interval

* Fixed refresh of price graph when data changes

* Bugfixes

* Fixed some issues with raw payload

* Adjustments for meter timestamp from Kamstrup

* Updated readme

* Added detailed breakdown of payloads coming from Norwegian meters

* Minor changes relating to price

* Fixed byte alignment on price config

* Changes to support RC upgraders
2025-11-13 15:10:54 +01:00
Gunnar Skjold
ffd8d46f2e Automatic reboot when MQTT is lost (#1058)
* Fixing board type overwrite, zmartcharge default issues and disabling entsoe

* Fixed Zmartcharge configuration issue

* Option to auto reboot if MQTT connection is lost
2025-11-06 18:26:40 +01:00
Gunnar Skjold
eefbc08222 Updated release workflow (#1054)
* Added workflow to release RC versions

* Added missing config to build file

* Made S3 bucket configurable from repo

* Updated release workflow
2025-11-04 13:40:54 +01:00
Gunnar Skjold
1a5b9542f4 Include device information when asking for new version (#1052) 2025-10-30 15:54:57 +01:00
Gunnar Skjold
19ff70782f Update for L&G in Austria (#1049)
* Fixing board type overwrite, zmartcharge default issues and disabling entsoe

* Fixed Zmartcharge configuration issue

* Support for LNG2 with 11 data points instead of 14
2025-10-23 08:17:25 +02:00
Gunnar Skjold
0dfd2d9022 Various bug fixes (#1041)
* Fixing board type overwrite, zmartcharge default issues and disabling entsoe

* Fixed Zmartcharge configuration issue
2025-10-16 08:50:03 +02:00
Gunnar Skjold
7a4ab77a83 Tooltip added to bar charts (#1022) 2025-10-02 13:55:31 +02:00
Gunnar Skjold
46cd8c6e68 Added hour to tariff peaks (#1028)
* Added hour to tariff peaks

* Some adjustments
2025-10-02 13:51:58 +02:00
Gunnar Skjold
c307103605 Added unique ID to HA firmware upgrade entity (#1027) 2025-10-02 13:23:36 +02:00
Gunnar Skjold
d9ec111458 Fixed duplicate deviceuid in HA when using ethernet (#1025) 2025-10-02 13:13:16 +02:00
Gunnar Skjold
e3a1aa78a9 Added tariff peaks and total month to MQTT JSON payload (#1026)
* Added tariff peaks to MQTT JSON payload

* Bugfix after testing
2025-10-02 13:11:28 +02:00
Gunnar Skjold
b06aa5f71b Improve power saving (#1024)
* Limit tasks in loop based on voltage

* Updated disconnect voltage limit

* Fixed 8266 build
2025-10-02 12:59:47 +02:00
Gunnar Skjold
6a75b0fe71 Command to request day or month plot data via MQTT (#1023) 2025-10-02 12:56:25 +02:00
Gunnar Skjold
e11fac3d11 Added deploy action for Localazy translations (#1014)
* Added deploy action for Localazy translations

* Fixed yml
2025-09-25 14:03:51 +02:00
Gunnar Skjold
031422f783 Show error when unknown data was received (#1013) 2025-09-25 12:20:31 +02:00
Gunnar Skjold
2ff8fddc14 Fixed incorrect enable state for ZmartCharge when no config (#1012) 2025-09-25 12:05:18 +02:00
Gunnar Skjold
e5d260ae3e Zmartcharge support (#1007)
* ZC initial implementation

* ZmartCharge

* Fixed zc bug

* Adjustments to ZmartCharge connection
2025-09-25 11:38:05 +02:00
Gunnar Skjold
633671851e Fixed Kamstrup timestamp parsing (#1011)
* Fixed kamstrup timestamp deviation

* Fixed check for time zone
2025-09-25 10:47:47 +02:00
Gunnar Skjold
69da9f9d48 Only allow board type overwrite from config if not set (#1010) 2025-09-25 10:47:35 +02:00
Gunnar Skjold
19f78126d6 Auto enable price fetch when region is changed (#1009) 2025-09-25 10:47:22 +02:00
Gunnar Skjold
d3cc92949a Trim leading and trailing whitespace (#1008) 2025-09-25 10:46:26 +02:00
Gunnar Skjold
f1089faab5 Maintian "no config" state after vendor config (#999) 2025-09-25 10:46:02 +02:00
Gunnar Skjold
4a3ad6ab9b Fixed /setup redirect after /vendor (#998) 2025-09-25 10:44:17 +02:00
Falke Carlsen
86449949c5 refactor: fix 'boundry' typo to 'boundary' (#982) 2025-09-25 10:43:57 +02:00
Gunnar Skjold
9bd9826835 Added GPIO 20 and 21 for ESP32-C3 (#979)
* Added GPIO 20 and 21 for C3

* Updated webapp after changing GPIO for C3
2025-09-25 10:39:55 +02:00
ArnieO
94ff9d6da7 Added Omnipower frame (#1002)
Kamstrup Omnipower frames from Bornholm, DK - with two decimals on the voltage reading. The customary is voltage without decimals. 
Received 9-sep-25.
2025-09-09 17:25:50 +02:00
ArnieO
9518d1811b Uploaded new *.raw file (#995)
From Landis&Gyr E350, HAN-NVE, Norway. Meter owner: https://klive.no/
2025-08-22 15:28:09 +02:00
ArnieO
983426b36c Add Poland docs (#987)
* Create Poland/Stoen folder structure

* Add PDF documents
2025-07-29 09:18:45 +02:00
Gunnar Skjold
bcb3c3b2ec Fixed price config with no dates (#974) 2025-06-05 11:47:36 +02:00
Gunnar Skjold
9fd383c1ef Updated release title (#973) 2025-06-05 08:05:50 +02:00
dependabot[bot]
a931f4cef8 Bump vite from 4.5.9 to 4.5.14 in /lib/SvelteUi/app (#972)
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.9 to 4.5.14.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.14/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.14/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 4.5.14
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-05 07:42:29 +02:00
Gunnar Skjold
fddecaab39 Added meter multipliers to config file (#971) 2025-06-05 07:42:12 +02:00
Gunnar Skjold
e5eab82d68 Use list type 4 when phase power is included in Slovenian format (#967) 2025-06-05 07:41:50 +02:00
Gunnar Skjold
8ae1d46b2a Fixed DSMR timestamp parsing (#966)
* Fixed DSMR parsing and added support for more formats

* Add current time as package timestamp for DSMR
2025-06-05 07:41:36 +02:00
Gunnar Skjold
99ccb03b45 Added per phase power for L&G (#965)
* Added phase power parsing for Austrian L&G

* Use list type 4 when L&G phase power is present
2025-06-05 07:41:19 +02:00
Gunnar Skjold
b8f2d501a5 Increased kwh resultion in plot json (#961) 2025-06-05 07:40:57 +02:00
Gunnar Skjold
e042806619 Fixed multiplier problem for some L&G meters (#960) 2025-06-05 07:40:44 +02:00
Gunnar Skjold
16f9ed7ecb Fixed hour skew on price modifier (#959)
* Use local timezone in price config

* Additional changes for previous commit

* Use CET/CEST for energy prices collected from server
2025-06-05 07:40:29 +02:00
Gunnar Skjold
3eaefefd26 Fixed price modifier date inclusion (#958)
* Support price config end before start

* More changes to fix price modifiers

* More changes to fix price modifiers
2025-06-05 07:40:09 +02:00
Gunnar Skjold
03c8c3ddbc Fixed release name (#953) 2025-06-05 07:39:36 +02:00
dependabot[bot]
08371b9078 Bump http-proxy-middleware from 2.0.7 to 2.0.9 in /lib/SvelteUi/app (#950)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.7 to 2.0.9.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.9/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.7...v2.0.9)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-version: 2.0.9
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-06-05 07:39:14 +02:00
Gunnar Skjold
a6ae25f3e7 Changed way of creating release (#944) 2025-03-24 10:51:07 +01:00
dependabot[bot]
8051db6a9b Bump esbuild from 0.18.20 to 0.25.1 in /lib/SvelteUi/app (#943)
Bumps [esbuild](https://github.com/evanw/esbuild) from 0.18.20 to 0.25.1.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2023.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.18.20...v0.25.1)

---
updated-dependencies:
- dependency-name: esbuild
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-24 09:10:54 +01:00
Gunnar Skjold
d0bfdae5d8 Automatic release notes (#942) 2025-03-24 09:05:02 +01:00
Gunnar Skjold
4d681ed2e2 Support fw upgrade via MQTT with JSON payload (#941) 2025-03-24 09:00:05 +01:00
Gunnar Skjold
8ee3f53714 Fixed firmare upload when web context is defined (#938) 2025-03-24 08:59:52 +01:00
Gunnar Skjold
e8cf8a98ed Fixed baud/parity autodetect (#937) 2025-03-24 08:59:40 +01:00
Gunnar Skjold
9153a98694 Fix: #935 - Brownout reboot loop (#936) 2025-03-24 08:59:30 +01:00
Gunnar Skjold
37aa6ae816 Fix: #918 - MQTT/SSL does not reconnect after disconnect (#933) 2025-03-24 08:59:18 +01:00
Gunnar Skjold
8a35346fcf Fixed backup and restore of price modifiers (#925) (#932)
* Fix: #925 - Backup/restore of price modifiers

* Removed unused importy
2025-03-24 08:58:31 +01:00
Gunnar Skjold
792ae4c935 Fix: #926 - Historical data lost when upgrading ESP8266 between 2.4.x versions (#931) 2025-03-24 08:58:14 +01:00
Gunnar Skjold
a7324d828a Fixed nullpointer in upgrade 2025-02-14 18:51:07 +01:00
Gunnar Skjold
fe739c51d3 Cloud stuff 2025-02-14 18:04:12 +01:00
Gunnar Skjold
795d2d0375 Some debugging of cloud connection 2025-02-14 14:51:47 +01:00
Gunnar Skjold
5ef36a91f6 Updated esbuild dependency 2025-02-13 13:10:50 +01:00
Gunnar Skjold
8491d6c471 Changed to the latest possible node version 2025-02-13 13:07:57 +01:00
Gunnar Skjold
f95f22058a Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2025-02-13 13:01:05 +01:00
Gunnar Skjold
b5c45cebfa Merge pull request #866 from saddfox/devcontainer
Add devcontainer
2025-02-13 12:55:57 +01:00
Gunnar Skjold
19a953b269 Updated workflows 2025-02-13 12:55:43 +01:00
Gunnar Skjold
6ae970ff68 Updated workflows 2025-02-13 12:45:43 +01:00
Gunnar Skjold
0f0ee82af9 Various bug fix for GUI 2025-02-13 12:33:54 +01:00
Gunnar Skjold
d84b9351e1 Fixed ESP8266 build 2025-02-03 18:02:20 +01:00
Gunnar Skjold
6668258b66 Support for update entity in HA 2025-02-03 17:51:36 +01:00
Gunnar Skjold
9c42aab04f Fixed extra price 2025-01-27 16:31:43 +01:00
Gunnar Skjold
c771870e3e Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2025-01-27 16:08:02 +01:00
Gunnar Skjold
fb59ee52c1 Merge pull request #890 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/nanoid-3.3.8
Bump nanoid from 3.3.7 to 3.3.8 in /lib/SvelteUi/app
2025-01-27 16:04:28 +01:00
Gunnar Skjold
3483910136 Merge pull request #907 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/vite-4.5.9
Bump vite from 4.5.5 to 4.5.9 in /lib/SvelteUi/app
2025-01-27 16:04:16 +01:00
Gunnar Skjold
13e70f7bd4 Merge pull request #906 from dbeinder/nullterm
Reserve space for null terminator
2025-01-27 16:03:44 +01:00
Gunnar Skjold
210001e232 Prevent meterid override 2025-01-24 13:22:08 +01:00
Gunnar Skjold
094e588ad5 Strip non-ascii from meter id 2025-01-24 07:44:21 +01:00
Gunnar Skjold
f9d0cdfa47 Fixed nullpointer 2025-01-23 21:37:17 +01:00
Gunnar Skjold
0476058958 Fixed wifi scan for 8266 2025-01-23 14:46:52 +01:00
Gunnar Skjold
3e337a5639 Option to enter manual SSID 2025-01-23 14:37:28 +01:00
Gunnar Skjold
bf0e1d1bf3 Lib updates 2025-01-23 14:16:05 +01:00
Gunnar Skjold
d3b65b0175 SSID scan 2025-01-23 14:13:23 +01:00
Gunnar Skjold
2caa7252a0 Enforce pattern on all input fields 2025-01-23 12:01:39 +01:00
Gunnar Skjold
f7596de166 Fixed memory leak 2025-01-23 11:22:03 +01:00
Gunnar Skjold
f5178459e8 Fixed incorrect additional price in array 2025-01-22 19:59:41 +01:00
Gunnar Skjold
a55f7dc66a Fixed vcc reading on esp8266 2025-01-22 19:09:08 +01:00
Gunnar Skjold
3d9cad8953 Fixed invalid characters in meterId 2025-01-22 17:56:33 +01:00
Gunnar Skjold
67535b2792 Fixed cloud connection for C3 2025-01-22 17:49:54 +01:00
Gunnar Skjold
2b5f3f50df Fixed cloud connection for C3 2025-01-22 17:49:38 +01:00
Gunnar Skjold
111807a743 Web framework update 2025-01-22 17:32:41 +01:00
dependabot[bot]
348ba8cfc4 Bump vite from 4.5.5 to 4.5.9 in /lib/SvelteUi/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 4.5.5 to 4.5.9.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v4.5.9/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v4.5.9/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-22 06:43:57 +00:00
david-beinder
81c72f0ca3 Reserve space for null terminator 2025-01-18 01:11:24 +01:00
Gunnar Skjold
20de294a8c Updated build 2025-01-12 18:21:40 +01:00
Gunnar Skjold
e31faaa726 Added a DSMR frame as documentation 2025-01-12 17:59:26 +01:00
Gunnar Skjold
4ad2921132 Fixed config reload for HA and Domoticz if changed 2025-01-12 12:01:16 +01:00
Gunnar Skjold
1fa62fa97c Fixed aidon package timestamp 2025-01-12 10:32:14 +01:00
Gunnar Skjold
affa66f78f Allow special characters in mqtt user/pass 2025-01-12 10:23:57 +01:00
Gunnar Skjold
84860bc684 Failsafe on combining tariff counters 2025-01-12 10:16:19 +01:00
Gunnar Skjold
0cadedf9df Fixed red blink after 49 days 2025-01-12 10:05:57 +01:00
Gunnar Skjold
0c3eea8d37 Added timestamp sensors to HA 2025-01-12 09:57:29 +01:00
Gunnar Skjold
1d4e7e564d Fixed timestamp bug 2025-01-09 15:35:22 +01:00
Gunnar Skjold
067aa0c6cb More changes for slovakian iskra 2024-12-23 11:57:32 +01:00
dependabot[bot]
3d540e2a65 Bump nanoid from 3.3.7 to 3.3.8 in /lib/SvelteUi/app
Bumps [nanoid](https://github.com/ai/nanoid) from 3.3.7 to 3.3.8.
- [Release notes](https://github.com/ai/nanoid/releases)
- [Changelog](https://github.com/ai/nanoid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ai/nanoid/compare/3.3.7...3.3.8)

---
updated-dependencies:
- dependency-name: nanoid
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-17 12:48:44 +00:00
Gunnar Skjold
61d4728ffa DSMR with encrypted payload 2024-12-14 10:54:02 +01:00
Gunnar Skjold
42e0ca963c Merge branch 'main' into pnu 2024-12-12 10:51:52 +01:00
Gunnar Skjold
3bc40cb136 Some adjustments for Iskra 2024-12-12 09:44:10 +01:00
Gunnar Skjold
1453bbbb7e Adjustments on auto updater for 8266 2024-12-07 21:45:47 +01:00
Gunnar Skjold
9da2d0760e More adjustments for auto update 2024-12-07 11:32:45 +01:00
Gunnar Skjold
18af98511a Some adjustments 2024-12-05 20:10:44 +01:00
Gunnar Skjold
40c84d2429 Fixed firmware upload from GUI 2024-12-05 19:15:17 +01:00
Gunnar Skjold
c0d95f918e Merge branch 'main' into pnu 2024-12-05 18:15:37 +01:00
Gunnar Skjold
0947d335ce Fixed unprocessable characters in json 2024-12-05 14:20:12 +01:00
Gunnar Skjold
43e2b2478b Added more for Slovenian Iskra 2024-12-05 13:57:33 +01:00
Gunnar Skjold
a5fc1f0cbe New firmware upload 2024-12-05 13:40:30 +01:00
Gunnar Skjold
bf3059ba04 Now moving LittleFS in a better way 2024-12-04 20:37:56 +01:00
Gunnar Skjold
319b534d4f Improved firmware update 2024-11-29 16:44:56 +01:00
Gunnar Skjold
b7c2510098 Store upgrade progress to eeprom 2024-11-29 11:26:00 +01:00
Gunnar Skjold
07205b8008 Merge branch 'main' into pnu
# Conflicts:
#	lib/HwTools/src/HwTools.cpp
#	lib/SvelteUi/app/dist/index.css
#	lib/SvelteUi/app/dist/index.js
#	lib/SvelteUi/app/vite.config.js
2024-11-29 08:05:49 +01:00
saddfox
165a385844 add devcontainer 2024-11-10 18:09:18 +01:00
Gunnar Skjold
fa76233151 Added missing code for setting mqtt keep alive 2024-11-09 15:44:30 +01:00
Gunnar Skjold
22b7877ee9 Fixed build error 2024-11-09 15:29:19 +01:00
Gunnar Skjold
bd9a1bb330 Some frame data 2024-11-09 15:17:04 +01:00
Gunnar Skjold
1b5efaa937 Fixed some labels 2024-11-09 15:16:53 +01:00
Gunnar Skjold
05ce4c5c1a Ability to change MQTT timeout and keepalive 2024-11-09 15:12:54 +01:00
Gunnar Skjold
e022f630b2 Removed UDP as recommended cloud connection method 2024-11-07 09:55:15 +01:00
Gunnar Skjold
a73ff87653 Removed UDP as recommended cloud connection method 2024-11-07 09:37:05 +01:00
Gunnar Skjold
70d6a8699b Added default settings to KMP communicator 2024-11-06 18:22:56 +01:00
Gunnar Skjold
118c633878 Fixed autodetect 2024-11-06 18:10:38 +01:00
Gunnar Skjold
fa5985f60b Prevent redirect loop when changing from context to empty 2024-11-04 08:41:34 +01:00
Gunnar Skjold
c1309e9a13 Add package timestamp if missing 2024-11-03 11:28:03 +01:00
Gunnar Skjold
718eef7999 Fixed configfile download when using context path 2024-11-03 11:21:35 +01:00
Gunnar Skjold
afdd282adf Make client id required 2024-11-03 10:43:27 +01:00
Gunnar Skjold
1302f18fab Adjustments to make IPv6 address visible in GUI 2024-11-03 10:21:13 +01:00
Gunnar Skjold
fc89670ea4 Manually merged changes from pull #826 2024-11-03 10:07:51 +01:00
Gunnar Skjold
225320ea7d git branchMerge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2024-11-03 10:02:00 +01:00
Gunnar Skjold
b2cf3bb0c4 Merge pull request #847 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/rollup-3.29.5
Bump rollup from 3.29.4 to 3.29.5 in /lib/SvelteUi/app
2024-11-03 09:59:23 +01:00
Gunnar Skjold
e36a8ade42 Merge pull request #848 from ackjewtn/add_wesp32_poe_board
Add support for wESP32-PoE board
2024-11-03 09:59:13 +01:00
Gunnar Skjold
2ef67d92c4 Fixed missing prices after changes in entsoe API 2024-11-03 09:51:54 +01:00
Peter Wahlberg
1c9af6b1c2 Revert formatting 2024-09-27 17:17:02 +02:00
Peter Wahlberg
4f47ffa21e Add support for wESP32-PoE board 2024-09-27 17:01:30 +02:00
dependabot[bot]
3d1026f829 Bump rollup from 3.29.4 to 3.29.5 in /lib/SvelteUi/app
Bumps [rollup](https://github.com/rollup/rollup) from 3.29.4 to 3.29.5.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v3.29.4...v3.29.5)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 05:02:27 +00:00
Gunnar Skjold
af6ecc5d47 Adjustments of clock parsing from dlms 2024-09-21 20:03:46 +02:00
Gunnar Skjold
025c556626 More relaxed on when hourly data is received 2024-09-21 16:04:05 +02:00
Gunnar Skjold
0b342d6c49 Some changes to data update 2024-09-21 13:00:22 +02:00
Gunnar Skjold
ada57b1052 Trying to fix data reset issue 2024-09-19 12:54:58 +02:00
Gunnar Skjold
cf773985b1 Merge pull request #836 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/svelte-4.2.19
Bump svelte from 3.59.2 to 4.2.19 in /lib/SvelteUi/app
2024-09-19 12:39:39 +02:00
Gunnar Skjold
75a14ad9cb Merge pull request #840 from ruffy91/patch-1
Added kWH multiplier to phases
2024-09-19 12:39:26 +02:00
Fabian
fbe90cbc5a Update IEC6205675.cpp
kWh multiplier also applies to all the phases, not only total energy
2024-09-04 21:38:20 +02:00
dependabot[bot]
f0bc895952 Bump svelte from 3.59.2 to 4.2.19 in /lib/SvelteUi/app
Bumps [svelte](https://github.com/sveltejs/svelte/tree/HEAD/packages/svelte) from 3.59.2 to 4.2.19.
- [Release notes](https://github.com/sveltejs/svelte/releases)
- [Changelog](https://github.com/sveltejs/svelte/blob/svelte@4.2.19/packages/svelte/CHANGELOG.md)
- [Commits](https://github.com/sveltejs/svelte/commits/svelte@4.2.19/packages/svelte)

---
updated-dependencies:
- dependency-name: svelte
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-30 17:21:59 +00:00
Gunnar Skjold
f5c10c1a50 Send price config to cloud 2024-08-24 21:22:43 +02:00
Gunnar Skjold
c4736c730e Send price config to cloud 2024-08-24 20:55:34 +02:00
Gunnar Skjold
d2c96c733c Send price config to cloud 2024-08-24 09:40:58 +02:00
Gunnar Skjold
d0dd9de4d7 Updated fix for missing graph data 2024-08-24 08:37:24 +02:00
Gunnar Skjold
159244974d Trying to fix issue 2024-08-20 20:55:26 +02:00
Gunnar Skjold
933926fbb4 Fixed debug logging 2024-08-15 20:02:35 +02:00
Gunnar Skjold
2c95f036ba Fixed power factor sensors in HA 2024-08-15 19:44:24 +02:00
Gunnar Skjold
c5c0b52eb7 Try to fix day clearing issue 2024-08-15 19:33:30 +02:00
Gunnar Skjold
561b62cafe Cloud configuration 2024-08-15 19:18:10 +02:00
Gunnar Skjold
55520cd7f6 GUI package upgrades 2024-08-06 20:54:39 +02:00
Gunnar Skjold
e27d41839e Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2024-08-06 20:52:41 +02:00
Gunnar Skjold
569a0ddfaa Some final adjustments 2024-08-06 20:51:02 +02:00
Gunnar Skjold
de63263dbb Fixed date skew when computer is on different timezone 2024-08-02 22:34:53 -08:00
Gunnar Skjold
8adb7055c0 Fixed date skew when computer is on different timezone 2024-08-02 19:02:00 -11:00
Gunnar Skjold
11e09c5b56 Fixed undefined month 2024-08-03 07:32:10 +02:00
Gunnar Skjold
ac32f74eba Bugfix 2024-08-02 19:59:30 +02:00
Gunnar Skjold
d49b8c3839 Option to disable UART TX 2024-08-02 19:59:16 +02:00
Gunnar Skjold
054fd43a0d Initial implementation of custom upgrade code 2024-08-02 17:56:39 +02:00
ArnieO
423c5da25e Uploaded overview of meters / interfaces 2024-07-17 09:11:04 +02:00
Gunnar Skjold
9a4a8a10f2 Corrected RSA block size 2024-07-14 21:31:17 +02:00
Gunnar Skjold
d15992142e Removed test ip 2024-07-14 21:24:29 +02:00
Gunnar Skjold
fed3948f85 Corrected RSA block size 2024-07-14 21:23:45 +02:00
Gunnar Skjold
b77342a648 Some cloud changes 2024-07-14 21:07:50 +02:00
Gunnar Skjold
04f407aba0 Stability improvements 2024-07-11 17:48:50 +02:00
Gunnar Skjold
b122fae04c Updated license headers 2024-07-11 14:03:00 +02:00
Gunnar Skjold
8a4efd0047 Restructuring to be able to include precompiled kmp lib 2024-07-11 13:15:22 +02:00
Gunnar Skjold
4407526d96 Changed order of if cases 2024-07-03 09:56:08 +02:00
Gunnar Skjold
1d91416348 Fix for meters with clock skew 2024-07-03 09:22:09 +02:00
Gunnar Skjold
a1bbcc20e3 Fixed 8266 build 2024-06-29 10:24:38 +02:00
Gunnar Skjold
2b779920d7 Fixed issue when graphs go blank if meter clock is running fast 2024-06-29 10:18:24 +02:00
Gunnar Skjold
de79fd4c43 Send prices to MQTT when having fixed price only 2024-06-29 10:15:15 +02:00
Gunnar Skjold
8dfaa34d03 Buffer adjustments for 8266 2024-06-29 10:14:43 +02:00
Gunnar Skjold
0d0dc07903 Some changes for cloud service 2024-06-29 10:13:41 +02:00
Gunnar Skjold
e38a064928 Fixed timezone issue in DLMS timestamps 2024-06-27 10:54:22 +02:00
Gunnar Skjold
81b3aacc4d Fixed debug 2024-06-15 09:21:12 +02:00
Gunnar Skjold
6277d5880d Updated frontened 2024-06-10 17:28:34 +02:00
Gunnar Skjold
8424d1f75e Set threephase when applying OBIS codes 2024-06-09 10:21:55 +02:00
Gunnar Skjold
099b23d2d5 Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2024-06-07 19:13:21 +02:00
Gunnar Skjold
28d746415c Remote KMP as selection in config 2024-06-07 19:13:03 +02:00
Gunnar Skjold
fd373a5846 Disable remote debug for C3 2024-06-07 19:12:33 +02:00
Gunnar Skjold
cd7315990f Build option to enable KMP 2024-06-07 18:55:37 +02:00
Gunnar Skjold
59bf0ce066 Build option to disable remote debug 2024-06-07 18:48:26 +02:00
Gunnar Skjold
93e55f457a Tariff thresholds on MQTT 2024-06-06 21:38:03 +02:00
Gunnar Skjold
4d340c5482 Use estimated if Aidon sends same value as last hour 2024-06-06 21:37:45 +02:00
Gunnar Skjold
1db0082103 Added export price sensor to HA payload 2024-06-06 18:09:33 +02:00
Gunnar Skjold
f593e14e68 Combined import/export in data.json 2024-06-06 17:34:33 +02:00
Gunnar Skjold
da6328c246 Fixed HA hostname ESP8266 build issue 2024-06-06 17:17:59 +02:00
Gunnar Skjold
5eeab2ba89 Fixed amperage plot 2024-06-06 15:55:43 +02:00
Gunnar Skjold
eeaaf088ac Fixed issues with HA sensors 2024-06-06 15:41:21 +02:00
Gunnar Skjold
32afea2817 Iskra 2024-06-04 20:33:03 +02:00
Gunnar Skjold
e7b496280d KMP stuff 2024-06-03 18:09:40 +02:00
Gunnar Skjold
d0621e98cd Fixed blank webpage 2024-05-30 14:07:45 +02:00
Gunnar Skjold
202d57843c Iskra case fix? 2024-05-30 13:28:50 +02:00
Gunnar Skjold
770d662f2c Changes to allow interaction with cloud service 2024-05-30 09:46:45 +02:00
Gunnar Skjold
da1d5993f4 Merge pull request #796 from devdems/main
Add Slovenia
2024-05-23 23:34:06 +02:00
Gunnar Skjold
7ad97daf86 Some cleanup 2024-05-23 22:20:01 +02:00
Gunnar Skjold
3b155d78b1 Removed som debugging 2024-05-23 21:58:17 +02:00
Gunnar Skjold
37a1e3b93e Another iskra special case 2024-05-23 20:57:32 +02:00
Gunnar Skjold
846cf85331 Use export price for export calculations 2024-05-23 20:33:13 +02:00
Gunnar Skjold
a1a6953521 Use export price for export cost calculations 2024-05-23 20:21:56 +02:00
Gunnar Skjold
a137316cec Added voltage check for all Pow* devices 2024-05-23 19:40:28 +02:00
Gunnar Skjold
faa468b287 Fixed loading order of json and when to display price graph 2024-05-23 19:12:38 +02:00
Gunnar Skjold
703c68a2cf Fixed autodetect 2024-05-23 18:58:20 +02:00
Gunnar Skjold
b6168a0082 Fixed 404 2024-05-23 17:35:17 +02:00
Gunnar Skjold
38ec99f2ee Move price elements 2024-05-23 17:34:26 +02:00
Gunnar Skjold
22f8349f2f Fixed bugs after testing 2024-05-23 17:13:32 +02:00
Gunnar Skjold
d98a021f39 Edit day and month data 2024-05-23 15:17:19 +02:00
Gunnar Skjold
77d899fe0a Fixed month in clock 2024-05-23 14:06:42 +02:00
Gunnar Skjold
c03bfcbcd7 Auto change buffer size based on baud rate when autodetect 2024-05-23 14:03:16 +02:00
Gunnar Skjold
f3732674b0 Fixed autodetect and enabled for Pow-K (To handle when configured as P1) 2024-05-23 13:59:16 +02:00
devdems
5926ddfaf9 Update ConfigurationPanel.svelte
Add Slovenia
2024-05-21 16:07:20 +02:00
Gunnar Skjold
99e341e582 Changed buffer size defaults and some null terminator issues on json mqtt 2024-05-01 07:38:30 +02:00
Gunnar Skjold
05506cdc9f Fixed ESP8266 build issue 2024-04-21 10:35:30 +02:00
Gunnar Skjold
3f1861deda MQTT on interval 2024-04-21 10:21:39 +02:00
Gunnar Skjold
efacbd4b31 Code restructuring 2024-04-21 08:43:59 +02:00
Gunnar Skjold
beaaa191e8 Color fix 2024-04-20 13:08:39 +02:00
Gunnar Skjold
43d49f21a3 Changed GPIO dropdowns 2024-04-20 10:51:27 +02:00
Gunnar Skjold
95c495b773 Some changes for cloud service 2024-04-20 09:13:41 +02:00
Gunnar Skjold
68c680debf Set TX pin low if passive communicator 2024-04-19 14:51:27 +02:00
Gunnar Skjold
fec6cc7612 Updated HA state class on realtime sensors 2024-04-19 08:48:57 +02:00
Gunnar Skjold
dc3cea80b6 Fixed HA state class on realtime sensors 2024-04-15 19:54:40 +02:00
Gunnar Skjold
ce67ef2bea Show current export price in export gauge 2024-04-14 14:47:53 +02:00
Gunnar Skjold
3a980fac4c Fixed price config 2024-04-14 14:20:46 +02:00
Gunnar Skjold
77873f4a38 Fixed mixup of last month cost and kwh 2024-04-14 13:33:11 +02:00
Gunnar Skjold
d9d384ea02 Fixed code 2024-04-14 13:30:46 +02:00
Gunnar Skjold
16fb1ea87c Fixed context bug 2024-04-14 13:24:20 +02:00
Gunnar Skjold
c74e719327 Fixed ESP8266 build issue 2024-04-13 11:38:03 +02:00
Gunnar Skjold
8c8e14f60c Some changes for cloud 2024-04-13 11:29:56 +02:00
Gunnar Skjold
3b93897a8e Added new headers to upgrade request 2024-04-13 10:19:08 +02:00
Gunnar Skjold
e080c7d535 Fixed static IP 2024-04-11 22:08:58 +02:00
Gunnar Skjold
64ea8c4888 Fixed static IP 2024-04-10 20:44:05 +02:00
Gunnar Skjold
e7ae24b26f Fixed accidental clearing more than just GPIO 2024-04-10 20:36:43 +02:00
Gunnar Skjold
84ff999c4c Fixed missing config tile 2024-04-09 21:57:44 +02:00
Gunnar Skjold
71e7e779da Some adjustments to GUI 2024-04-09 20:52:57 +02:00
Gunnar Skjold
99904f9097 Fixed stuck value 2024-04-09 18:12:23 +02:00
Gunnar Skjold
89015191de Improved MQTT stability and changed some defaults 2024-04-09 17:16:12 +02:00
Gunnar Skjold
a7d3382947 Fixed missing L2 2024-04-08 14:59:53 +02:00
Gunnar Skjold
abef32c73c Fixed some defaults 2024-04-07 12:01:05 +02:00
Gunnar Skjold
b52c580f6f Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2024-04-07 11:50:02 +02:00
Gunnar Skjold
429f0ba699 Merge pull request #761 from avandorp/avandorp-ha-uptime-device-class
Use correct home assistant device class for uptime
2024-04-07 11:45:02 +02:00
Gunnar Skjold
d918a593ce Removed connect timeout from MQTT 2024-04-07 11:31:21 +02:00
Arthur van Dorp
fb410ecfef Use correct home assistant device class for uptime 2024-04-06 21:43:06 +02:00
Gunnar Skjold
ee6c249370 Cloud updates 2024-04-06 12:53:36 +02:00
Gunnar Skjold
05b340738e Make realtime plot work for production 2024-04-06 12:53:17 +02:00
Gunnar Skjold
86663f53f6 Some adjustments and debugging for realtime plot 2024-04-06 12:16:08 +02:00
Gunnar Skjold
bd11dee1e5 White numbers on graph in dark mode 2024-04-06 11:44:41 +02:00
Gunnar Skjold
29c8011cda Changes for cloud 2024-04-06 11:34:04 +02:00
Gunnar Skjold
4884d3a0e2 Merge pull request #757 from UtilitechAS/dev-v2.3
Dev v2.3
2024-04-05 21:55:49 +02:00
Gunnar Skjold
6079b17e3d Remove unnecessary style 2024-04-05 21:33:57 +02:00
Gunnar Skjold
d069d4e102 Remove unknown headers 2024-04-05 21:23:44 +02:00
Gunnar Skjold
e1162ad970 Fixed 8266 build 2024-04-05 21:01:16 +02:00
Gunnar Skjold
71be381e1a Fixed error 2024-04-05 20:54:08 +02:00
Gunnar Skjold
a19901b58f Cloud config in config print 2024-04-05 20:16:43 +02:00
Gunnar Skjold
361d3a38ed Changed LED behaviour when in AP mode 2024-04-04 19:53:44 +02:00
Gunnar Skjold
c22bca3130 Fixed config export and import 2024-04-04 19:31:16 +02:00
Gunnar Skjold
2bfd863882 Added ESP32-S3 build 2024-04-04 16:12:27 +02:00
Gunnar Skjold
17c87c40df Set some defaults 2024-04-04 15:46:26 +02:00
Gunnar Skjold
10b76ab2e6 Adjustments 2024-04-04 15:26:13 +02:00
Gunnar Skjold
15c3b2067c Fixed removal of price config row 2024-04-04 14:56:55 +02:00
Gunnar Skjold
e366f10632 Removed logging 2024-04-04 14:40:59 +02:00
Gunnar Skjold
fc1850195b Adjustments to realtime plot 2024-04-04 14:31:33 +02:00
Gunnar Skjold
b85d11b1f3 Merge branch 'main' into dev-v2.3 2024-04-04 13:38:14 +02:00
Gunnar Skjold
fff6d1b068 Temporarily removed KMP 2024-04-04 13:37:17 +02:00
Gunnar Skjold
bdb0bf3df0 Merge pull request #742 from avandorp/patch-1
Add uptime to system sensors for home assistant
2024-04-04 10:03:59 +02:00
Gunnar Skjold
c6e111c347 Merge pull request #747 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/follow-redirects-1.15.6
Bump follow-redirects from 1.15.4 to 1.15.6 in /lib/SvelteUi/app
2024-04-04 10:03:32 +02:00
Gunnar Skjold
063b960fc2 Merge pull request #755 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/vite-3.2.10
Bump vite from 3.2.8 to 3.2.10 in /lib/SvelteUi/app
2024-04-04 10:03:21 +02:00
Gunnar Skjold
95967aaf59 Fixed debug on HAN error 2024-04-04 09:35:39 +02:00
dependabot[bot]
34e103c1d8 Bump vite from 3.2.8 to 3.2.10 in /lib/SvelteUi/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 3.2.8 to 3.2.10.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v3.2.10/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v3.2.10/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-03 18:48:26 +00:00
Gunnar Skjold
bdd2ec10cd Adjusted x-labels on realtime plot 2024-04-02 13:01:00 +02:00
Gunnar Skjold
37f90cb267 White logo and some adjustments 2024-04-02 12:57:08 +02:00
Gunnar Skjold
db90dbfd8f Adjustments to realtime plot 2024-04-02 12:05:29 +02:00
Gunnar Skjold
61d23ab453 Fixed LNG 0 values 2024-04-02 11:43:45 +02:00
Gunnar Skjold
864cd1fbbb Fixed breaking data 2024-04-02 11:35:37 +02:00
Gunnar Skjold
517869f43d GUI improvements after testign 2024-04-02 10:54:40 +02:00
Gunnar Skjold
766849d6fc Adjustment 2024-03-26 13:39:29 +01:00
Gunnar Skjold
67e6a51a8a Force board profiles on boot 2024-03-26 10:40:56 +01:00
Gunnar Skjold
4093b64dd0 Fixed 8266 build 2024-03-26 10:40:37 +01:00
Gunnar Skjold
4068f127ba Color adjustments 2024-03-25 10:16:33 +01:00
Gunnar Skjold
71abe188ca MQTT JSON classic/multi topic/flat 2024-03-23 11:20:39 +01:00
Gunnar Skjold
5022f42692 New strategy for updating data storage 2024-03-23 09:12:58 +01:00
Gunnar Skjold
6c1401d042 Fixed data loading 2024-03-21 20:49:32 +01:00
Gunnar Skjold
7041a29894 Natural rounding 2024-03-21 20:37:06 +01:00
Gunnar Skjold
e292f79421 Roaming support 2024-03-21 20:27:11 +01:00
Gunnar Skjold
d7ce808321 Added label comments for ethernet boards 2024-03-21 14:25:05 +01:00
Gunnar Skjold
210ddad515 Show tariff when using NOx with support 2024-03-21 14:21:39 +01:00
Gunnar Skjold
449257ae3f Update meter config when changed 2024-03-21 14:18:35 +01:00
Gunnar Skjold
def9867990 Changed calculation behaviour 2024-03-21 13:49:16 +01:00
Gunnar Skjold
26a63e30e0 Increased range for counters in data storage 2024-03-21 13:39:14 +01:00
Gunnar Skjold
9efdf1daa5 Changed variable type 2024-03-21 09:13:13 +01:00
Gunnar Skjold
f2e7879974 Optimized some JSONs 2024-03-21 08:57:56 +01:00
Gunnar Skjold
b8ac1a9565 Removed some debug 2024-03-20 19:30:38 +01:00
Gunnar Skjold
14eb27e0d9 crc 2024-03-19 21:50:09 +01:00
Gunnar Skjold
f68666bd4a crc 2024-03-19 11:31:14 +01:00
Gunnar Skjold
2087c287bf Fixed 8266 build 2024-03-18 17:05:09 +01:00
Gunnar Skjold
d85da6c9cb Added more baud rates 2024-03-18 17:04:31 +01:00
Gunnar Skjold
6a99b0a6a7 8N2 2024-03-17 09:50:49 +01:00
Gunnar Skjold
dfca5e37dc CRC and Pow board profile 2024-03-17 09:14:02 +01:00
dependabot[bot]
1f74f1e6b2 Bump follow-redirects from 1.15.4 to 1.15.6 in /lib/SvelteUi/app
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-16 23:22:24 +00:00
Gunnar Skjold
bdba6a0254 Support TX pin 2024-03-16 20:32:45 +01:00
Gunnar Skjold
7c4c096e94 KMP 2024-03-15 18:26:50 +01:00
Gunnar Skjold
1ab5a4d2cb Visual updates 2024-03-15 18:26:30 +01:00
Gunnar Skjold
4bd2b5230b Updated unit scaling 2024-03-15 18:26:13 +01:00
Gunnar Skjold
c0945abfa0 Timeout on MQTT 2024-03-15 18:23:18 +01:00
Gunnar Skjold
d94f27949c Dependency update 2024-03-15 18:22:32 +01:00
Gunnar Skjold
6a427b513d Added sensors to LNG format 2024-03-15 18:21:17 +01:00
Gunnar Skjold
47a7d4e13b KMP headers 2024-03-10 09:03:06 +01:00
Gunnar Skjold
263ce9749a Prep for KMP 2024-03-06 19:47:57 +01:00
Gunnar Skjold
13d0521984 Prep for KMP 2024-03-06 19:44:44 +01:00
Gunnar Skjold
e3511f0ee2 Fixed HDLC partitioning 2024-03-04 09:08:31 +01:00
Gunnar Skjold
f4de3e6178 Fixed language switch problem 2024-03-02 09:03:45 +01:00
Gunnar Skjold
2bb5361b22 Testing logo change 2024-03-02 08:33:28 +01:00
Gunnar Skjold
9caec71e1c Support HDLC segmentation 2024-03-02 08:33:19 +01:00
Gunnar Skjold
7813d3ea08 Fixed ESP32 UART2 2024-03-02 07:51:11 +01:00
Arthur van Dorp
73ed4f87e4 Add uptime to system sensors for home assistant
Uptime is already part of the MQTT messages, but not sensors indicated to home assistant. Useful for troubleshooting purposes.
2024-03-01 18:41:38 +01:00
Gunnar Skjold
c06dabba51 Adjustments for high scale wattage 2024-02-29 15:41:34 +01:00
Gunnar Skjold
23cbcf9a0a Adjustments for v2.3 testing 2024-02-29 14:20:51 +01:00
Gunnar Skjold
785cefabb5 Merge branch 'main' into dev-v2.3 2024-02-29 09:06:47 +01:00
Gunnar Skjold
aa6283de5b Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2024-02-29 09:00:23 +01:00
Gunnar Skjold
2b563c7230 Fixed error blink after 49.7 days 2024-02-29 08:54:42 +01:00
Gunnar Skjold
45d0fa2bfa Fixed code 2024-02-29 08:53:47 +01:00
ArnieO
09fdd2dc22 Update LICENSE
Correct two cases of garbled text where there should have been apostrophe sign.
2024-02-15 12:29:29 +01:00
Gunnar Skjold
ab2086f909 Fixed price save 2024-02-15 08:40:08 +01:00
Gunnar Skjold
16d1ee9761 Fixed IPv6 tick 2024-02-15 08:11:38 +01:00
Gunnar Skjold
348488af72 Stripping some debugging 2024-02-14 20:06:18 +01:00
Gunnar Skjold
9103a5b730 Adjustments to WDT 2024-02-13 20:54:44 +01:00
Gunnar Skjold
830e22d182 IPv6 support 2024-01-31 20:58:46 +01:00
Gunnar Skjold
21bff28aee Smart config 2024-01-26 20:17:13 +01:00
Gunnar Skjold
e9472513d2 MQTT LWT 2024-01-26 19:47:28 +01:00
Gunnar Skjold
b6e69ca5d0 Merge pull request #711 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/follow-redirects-1.15.4
Bump follow-redirects from 1.15.2 to 1.15.4 in /lib/SvelteUi/app
2024-01-26 19:39:52 +01:00
Gunnar Skjold
d28ef99cee Merge pull request #719 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/vite-3.2.8
Bump vite from 3.2.7 to 3.2.8 in /lib/SvelteUi/app
2024-01-26 19:39:37 +01:00
Gunnar Skjold
3b531fab5b Merge branch 'main' into dev-v2.3 2024-01-26 19:29:58 +01:00
Gunnar Skjold
e575ab755c Only authenticate GCM if auth key available 2024-01-26 19:21:27 +01:00
Gunnar Skjold
1ba452213d Removed debugging 2024-01-26 19:15:56 +01:00
Gunnar Skjold
a2c20575c8 Pulse meter 2024-01-26 18:23:40 +01:00
Gunnar Skjold
9a767d9ac4 Pulse meter 2024-01-26 18:21:51 +01:00
Gunnar Skjold
52bc2f6a9b Special price regions for NO with government support 2024-01-25 18:03:23 +01:00
Gunnar Skjold
cfa4502af8 Some changes to make firmware fit on all platforms 2024-01-25 12:27:26 +01:00
Gunnar Skjold
6fe308b5f6 Platform update 2024-01-23 21:06:20 +01:00
Gunnar Skjold
80be1ceef1 Subtract price 2024-01-23 20:41:56 +01:00
Gunnar Skjold
bfa1a65dfd Some changes 2024-01-20 16:25:28 +01:00
Gunnar Skjold
afcc542e25 Fixed build errors 2024-01-20 13:49:47 +01:00
Gunnar Skjold
f334847e82 Fixed debug 2024-01-20 13:47:57 +01:00
Gunnar Skjold
9eb56beb6c GUI translations 2024-01-20 13:47:42 +01:00
dependabot[bot]
87c565763a Bump vite from 3.2.7 to 3.2.8 in /lib/SvelteUi/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 3.2.7 to 3.2.8.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v3.2.8/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v3.2.8/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-19 23:40:56 +00:00
Gunnar Skjold
87ddf00afa Support for pulse meter 2024-01-18 07:57:56 +01:00
Gunnar Skjold
e7ca408baa Fixed host and ip change issues 2024-01-11 14:03:20 +01:00
dependabot[bot]
1d5c45c43c Bump follow-redirects from 1.15.2 to 1.15.4 in /lib/SvelteUi/app
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.4.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.15.2...v1.15.4)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-01-10 20:02:12 +00:00
Gunnar Skjold
183cb1e2b1 Adjustments after changing type of phase power 2024-01-07 11:04:43 +01:00
Gunnar Skjold
768dc97c9c Per phase power and power factor graphs 2024-01-07 10:58:11 +01:00
Gunnar Skjold
fe3f100edb Merge branch 'main' into dev-v2.3 2024-01-06 20:12:27 +01:00
Gunnar Skjold
8a59fcb89a Adaptations for new sensors 2024-01-06 20:10:33 +01:00
Gunnar Skjold
333169ef8f Merge pull request #613 from cnrd/phase-accumlation
Added support for getting accumulated energy for phases (Kamstrup)
2024-01-06 19:53:10 +01:00
Gunnar Skjold
d497aa91f4 Fixed month/day limitations on prices 2024-01-06 19:34:50 +01:00
Gunnar Skjold
b951fe9099 Fixed 8266 build 2024-01-06 19:11:22 +01:00
Gunnar Skjold
48ab87ba50 Support start and end date on prices 2024-01-06 18:58:50 +01:00
Gunnar Skjold
bad107926c Fixed cloud bugs 2024-01-06 10:05:44 +01:00
Gunnar Skjold
6012c19fc4 Updated cloud connector 2024-01-06 09:52:35 +01:00
Gunnar Skjold
460238e99d Support changing context path to accomodate being behind a proxy 2023-12-26 10:10:58 +01:00
Gunnar Skjold
64870cf9ca Adjustments to export plot color 2023-12-25 19:43:25 +01:00
Gunnar Skjold
cd446f8cb8 Some adjustments to realtime plot 2023-12-25 19:36:55 +01:00
Gunnar Skjold
f68a3a321a Modifications to dark mode 2023-12-25 19:25:43 +01:00
Gunnar Skjold
9ff6cf355f Fixing bugs 2023-12-25 18:36:35 +01:00
Gunnar Skjold
453492b5eb Fixed percent price 2023-12-25 14:52:22 +01:00
Gunnar Skjold
f11263a48f Fixed link color 2023-12-25 14:48:46 +01:00
Gunnar Skjold
fffd95dcf2 Price config 2023-12-25 14:47:28 +01:00
Gunnar Skjold
fa87cfaa61 Fixed build errors 2023-12-25 07:44:42 +01:00
Gunnar Skjold
50de5abf93 Merge branch 'main' into dev-v2.3 2023-12-25 07:41:01 +01:00
Gunnar Skjold
b1294fdd86 Run default device tests 2023-12-24 11:33:44 +01:00
Gunnar Skjold
ce2a67a284 Confirm firmware version 2023-12-24 10:18:35 +01:00
Gunnar Skjold
39e42d5333 Upload firmware to target 2023-12-24 09:13:21 +01:00
Gunnar Skjold
7503f9a077 Upload firmware to target 2023-12-24 09:12:21 +01:00
Gunnar Skjold
651f72489c Fixed workflow file 2023-12-24 08:47:00 +01:00
Gunnar Skjold
3596a87ff9 Using internal python 2023-12-24 08:15:38 +01:00
Gunnar Skjold
5c1acf5c45 Changed python on build to 3.11 2023-12-24 08:14:21 +01:00
Gunnar Skjold
c46b7972d0 Changes to workflow 2023-12-24 08:01:08 +01:00
Gunnar Skjold
df26c91a3b Initial actions-driven test environment 2023-12-24 07:59:05 +01:00
Gunnar Skjold
7a70bd7511 Some adjustments to MQTT 2023-12-24 07:10:58 +01:00
Gunnar Skjold
c583c2b44a Fixed mqtt changed flag 2023-12-24 07:03:05 +01:00
Gunnar Skjold
4c28d512a1 Changed mqtt disconnect to avoid exception 2023-12-24 06:59:40 +01:00
Gunnar Skjold
1775d0abce Fixed bug 2023-12-24 06:30:36 +01:00
Gunnar Skjold
8e65f1fe14 Fixed bug 2023-12-24 06:27:24 +01:00
Gunnar Skjold
c1d1bf6bb5 Fixed bug 2023-12-23 21:52:19 +01:00
Gunnar Skjold
fc09ab5cc9 Slight update on how missing I2 is shown 2023-12-23 18:39:09 +01:00
Gunnar Skjold
6e3a6f71e2 Fixed buffer issues and ESP8266 HA reboot issue" 2023-12-23 18:32:27 +01:00
Gunnar Skjold
557ba659d5 Make sure MQTT config is updated for current connection if changed 2023-12-22 19:47:00 +01:00
Gunnar Skjold
32ad71bba6 Fixed checking "Clear all other configuration" 2023-12-21 15:56:30 +01:00
Gunnar Skjold
8816097bca Fixed receive buffer for large payloads 2023-12-21 15:25:23 +01:00
Gunnar Skjold
378b67a5bd Show when I2 is unavailable 2023-12-21 14:50:20 +01:00
Gunnar Skjold
859868c99b Use multipliers with DSMR 2023-12-21 14:23:36 +01:00
Gunnar Skjold
d7ca741c92 Some changes for HA 2023-12-21 14:12:46 +01:00
Gunnar Skjold
d49753ed33 Resend sensors to HA if online status received 2023-12-15 20:37:25 +01:00
Gunnar Skjold
2ae15ac13a Expire time on HA sensors 2023-12-15 20:19:49 +01:00
Gunnar Skjold
00278659f8 Resend sensors to HA if online status received 2023-12-15 20:03:24 +01:00
Gunnar Skjold
0c1525b018 Fixed ESP8266 for previous commit 2023-12-15 19:04:39 +01:00
Gunnar Skjold
ed778441d5 Ability to load cert/key for mqtt without ca 2023-12-15 18:50:08 +01:00
Gunnar Skjold
c43c07386a Fixed some minuor issues 2023-12-10 18:01:57 +01:00
Gunnar Skjold
91958f5464 Show AP IP if no connection handler 2023-12-10 17:31:39 +01:00
Gunnar Skjold
194905237b Added ESP32S3 2023-12-10 17:27:16 +01:00
Gunnar Skjold
f3805ad111 Fixed build issue 2023-12-10 17:05:09 +01:00
Gunnar Skjold
0f22fd561e Improved ethernet connection 2023-12-10 16:56:13 +01:00
Gunnar Skjold
ee462ec468 Merge branch 'main' into dev-v2.3 2023-12-10 09:49:22 +01:00
Gunnar Skjold
ed899440ed Typ-o fix 2023-12-10 09:17:44 +01:00
Gunnar Skjold
8e9e60ec03 Fixed build 2023-12-04 14:01:24 +01:00
Gunnar Skjold
a121fbd28e Updated build 2023-12-04 13:48:45 +01:00
Gunnar Skjold
d823d747a5 Updated build 2023-12-04 13:42:53 +01:00
Gunnar Skjold
c1b35b8ce0 Some changes before release 2023-12-04 13:40:58 +01:00
Gunnar Skjold
fd996f44ba URL for price sources 2023-12-04 13:18:12 +01:00
Gunnar Skjold
0606c47367 Merge branch 'main' of github.com:UtilitechAS/amsreader-firmware 2023-12-04 13:00:10 +01:00
Gunnar Skjold
b6cd55719c Added cHF as currency 2023-12-04 12:58:08 +01:00
Gunnar Skjold
b79f48d6ac Merge pull request #682 from UtilitechAS/license_migration
Migrating to Fair Source license
2023-12-04 12:50:57 +01:00
Gunnar Skjold
ad342d2b7a Changed L2 calculation formula 2023-12-04 12:46:17 +01:00
Gunnar Skjold
8eb7136981 Additional delay for exchange rate fetch 2023-12-04 12:31:21 +01:00
Gunnar Skjold
1c5303e771 Default multiplier 1.0 2023-12-04 12:20:59 +01:00
Gunnar Skjold
9efc19090e Improved feedback for upgrade error 2023-12-04 12:17:07 +01:00
Gunnar Skjold
a30cd76354 Indicator for estimated I2. Also fix on charts 2023-12-04 11:59:18 +01:00
Gunnar Skjold
ddd08e25df Keep last reason for reboot 2023-12-03 21:38:20 +01:00
Gunnar Skjold
09d255d656 Fix 2023-12-03 21:14:26 +01:00
Gunnar Skjold
7239f295e8 Fixed volt and amp for some browsers 2023-12-03 21:13:48 +01:00
Gunnar Skjold
111bd70763 Merge branch 'main' into dev-v2.3 2023-11-25 10:46:46 +01:00
Gunnar Skjold
0e6abd0f18 Removing option for auto reboot on wifi error 2023-11-25 10:31:21 +01:00
Gunnar Skjold
2b0626b203 Enabled tariff thresholds for sweden 2023-11-25 10:18:49 +01:00
Gunnar Skjold
afa013ca03 Renamed EntsoeApi to PriceService 2023-11-25 10:04:21 +01:00
Gunnar Skjold
6d4d901dba Migrating to new license 2023-11-25 09:11:13 +01:00
Gunnar Skjold
9c66a47464 Updates for MQTT handler 2023-11-25 09:08:56 +01:00
Gunnar Skjold
5dc405f1da Trying to fix barchart 2023-11-25 09:05:45 +01:00
Gunnar Skjold
a2977180c1 Preserve old exchange rate if new cannot be fetched 2023-11-25 09:05:30 +01:00
Gunnar Skjold
725af5150d Adjustments to GUI 2023-11-25 09:05:17 +01:00
Gunnar Skjold
f734cb2179 SSDP 2023-11-25 09:04:33 +01:00
Gunnar Skjold
8a0c0298ab Some adjustments for fetching exchange rate 2023-11-25 09:04:06 +01:00
Gunnar Skjold
56b6a720c9 Some changes for DLMS 2023-11-16 20:43:47 +01:00
Gunnar Skjold
76d76844a9 Merge branch 'master' into dev-v2.3 2023-11-16 18:35:50 +01:00
Gunnar Skjold
ae82914795 Initial changes for v2.3 2023-11-16 18:21:56 +01:00
Gunnar Skjold
0fa178a617 Merge branch 'mqtt_changes' 2023-11-16 18:20:50 +01:00
Gunnar Skjold
8cada69aaf Migrating to new license 2023-11-16 17:59:33 +01:00
Gunnar Skjold
6bdd7855a7 8266 2023-11-08 20:47:55 +01:00
Gunnar Skjold
faafc5a993 Fix 8266 2023-11-08 20:41:05 +01:00
Gunnar Skjold
bbaf96f532 Merge branch 'master' into mqtt_changes 2023-11-08 20:34:39 +01:00
Gunnar Skjold
133c8bc967 Limit buffer size on ESP8266 to avoid reboots 2023-11-08 18:52:27 +01:00
Gunnar Skjold
f04e15f5d0 Limit buffer size on ESP8266 to avoid reboots 2023-11-08 18:40:37 +01:00
Gunnar Skjold
445973f9ce Some updates for price fetching 2023-11-05 10:24:42 +01:00
Gunnar Skjold
d6af7374c2 Merge branch 'master' into mqtt_changes 2023-11-03 19:57:17 +01:00
Gunnar Skjold
63c3d31552 Increased MQTT write buffer size 2023-11-01 21:53:56 +01:00
Gunnar Skjold
d82e705875 Ensure that the default 1.0 multiplier for currency is not used 2023-11-01 21:48:44 +01:00
Gunnar Skjold
206c90ca46 Fixed price display for 25hr days 2023-10-29 09:47:58 +01:00
Gunnar Skjold
92ceb316cb Changes to energyspeedometer QT 2023-10-28 08:30:15 +02:00
Gunnar Skjold
a6d8857655 Fixed number of decimal points on MQTT payload 2023-10-28 08:20:39 +02:00
Gunnar Skjold
98858315de Changes for Energy Speedometer connection 2023-10-20 14:33:56 +02:00
Gunnar Skjold
1ceffd0bc9 Changes for Energy Speedometer connection 2023-10-20 13:26:38 +02:00
Gunnar Skjold
f7cb022e3e Merge branch 'master' into mqtt_changes 2023-10-20 08:13:52 +02:00
Gunnar Skjold
4634050700 Ability to clear fixed price 2023-10-15 15:47:31 +02:00
Gunnar Skjold
60fff4533a 11b mode for 8266 2023-10-15 15:47:05 +02:00
Gunnar Skjold
6a0921a445 Added option to disable 802.11b for ESP8266 2023-10-14 08:44:55 +02:00
Gunnar Skjold
2a44f89a7b Disabling voltage check for wifi 2023-10-14 08:20:11 +02:00
Gunnar Skjold
7b025ddb01 Moved MQTT connection into handler 2023-10-14 08:07:56 +02:00
Gunnar Skjold
f9b4680b9c Improved MQTT SSL 2023-10-12 18:44:40 +02:00
Gunnar Skjold
2a10096306 Merge pull request #652 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/postcss-8.4.31
Bump postcss from 8.4.24 to 8.4.31 in /lib/SvelteUi/app
2023-10-11 20:24:25 +02:00
Gunnar Skjold
17d8d325c0 Added support for MQTTs without CA validation and public/private key 2023-10-11 20:23:53 +02:00
Gunnar Skjold
88ddc6ea15 Fixed runaway price update 2023-10-10 21:08:37 +02:00
Gunnar Skjold
3af19c9b15 Minor adjustment to autodisable of 802.11b 2023-10-10 20:54:13 +02:00
dependabot[bot]
2d6b523e37 Bump postcss from 8.4.24 to 8.4.31 in /lib/SvelteUi/app
Bumps [postcss](https://github.com/postcss/postcss) from 8.4.24 to 8.4.31.
- [Release notes](https://github.com/postcss/postcss/releases)
- [Changelog](https://github.com/postcss/postcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/postcss/postcss/compare/8.4.24...8.4.31)

---
updated-dependencies:
- dependency-name: postcss
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-07 20:36:22 +00:00
Gunnar Skjold
28a6a62907 Fixed issue where price graph disappears 2023-10-04 07:01:13 +02:00
Gunnar Skjold
be9b7a16e4 Removed 802.11b tick from ESP8266 2023-09-26 20:53:14 +02:00
Gunnar Skjold
81dedcbf6e Fix for negative calculated L2 current 2023-09-26 20:40:46 +02:00
Gunnar Skjold
248660e818 Auto disable 802.11b for BUS powered devices on first boot if possible 2023-09-26 20:32:54 +02:00
Gunnar Skjold
1a265492dd Fixed realtime data update 2023-09-26 20:14:08 +02:00
Gunnar Skjold
7b0c2eea33 Fixed realtime data update 2023-09-26 20:12:24 +02:00
Gunnar Skjold
f459b0af14 Experimenting with different color for export 2023-09-24 07:41:14 +02:00
Gunnar Skjold
545be710ba Smarter price fetch from GUI 2023-09-23 20:16:30 +02:00
Gunnar Skjold
fc01d7fd56 Removed unnecessary ESP32 check 2023-09-23 14:23:18 +02:00
Gunnar Skjold
954984d8ee Fixed build error 2023-09-23 14:12:48 +02:00
Gunnar Skjold
dd47523fd0 Updated gui dist 2023-09-23 14:05:22 +02:00
Gunnar Skjold
9b9d535dd0 Merge pull request #606 from dbeinder/use11b
Add option to disable 802.11b data rates
2023-09-23 14:04:01 +02:00
Gunnar Skjold
e2ff7613b6 Merge branch 'master' into use11b 2023-09-23 14:03:55 +02:00
Gunnar Skjold
b9d6f16529 Improved voltage check for pow-u 2023-09-21 09:27:18 +02:00
Gunnar Skjold
96c9c4c3a2 Possible fix for overflow situation 2023-09-20 20:30:15 +02:00
Gunnar Skjold
3229ae237e Fix for tariff peak overwrite 2023-09-20 20:29:54 +02:00
Gunnar Skjold
ecea4977b1 Updated ttl on web resources 2023-09-13 19:52:23 +02:00
Gunnar Skjold
a3551316ba Changed from slow to normal mem for noinit attr 2023-09-13 19:48:36 +02:00
Gunnar Skjold
03edc65a7a Preserve realtime data on reboot. Also disconnect WiFi on Pow-U if power drops too low 2023-09-12 20:50:23 +02:00
Gunnar Skjold
40215ee746 Fixed uptime rollower in MQTT raw mode 2023-09-12 18:58:25 +02:00
Gunnar Skjold
b76efc42db Fixed peak sensor for HA 2023-09-11 08:27:41 +02:00
Gunnar Skjold
94debd4233 Added CPU frequency to status page 2023-09-10 20:51:21 +02:00
Gunnar Skjold
dfbfbab531 Changed wifi disconnect behaviour 2023-09-10 20:38:07 +02:00
Gunnar Skjold
b91dc5a17d Fixed issue where downscaling caused data to be lost 2023-09-05 13:24:10 +02:00
Gunnar Skjold
67ca1fed01 Added a conditional vcc pin to s2 mini profile 2023-09-05 12:15:18 +02:00
Gunnar Skjold
baf8dc8310 De-centered zero line in graphs 2023-09-05 11:40:10 +02:00
Gunnar Skjold
6b0ea0abc0 Store current price in HA LTS 2023-09-05 10:54:31 +02:00
Gunnar Skjold
bcea9698dd Apply previous state when receiving only accumulated values from meter 2023-09-05 08:57:15 +02:00
Gunnar Skjold
b435f0eaaf Previously uncommited change 2023-08-31 09:32:21 +02:00
Gunnar Skjold
61c5500fdd Fixed red HAN after 49.7 days 2023-08-31 09:18:48 +02:00
Gunnar Skjold
719ceb610c Fixed realtime export counter 2023-08-24 07:49:09 +02:00
Gunnar Skjold
fc42d4391b Fixed ENTSO-E price fetching around midnight 2023-08-18 09:20:41 +02:00
Gunnar Skjold
53afd37d08 Do not show serial break 2023-08-18 09:09:39 +02:00
Gunnar Skjold
103fe5c457 Fixed alignment on iskra 2023-08-01 08:45:15 +02:00
Gunnar Skjold
494cb55ef4 Added previously unadded change for date correction in gui 2023-07-31 08:54:35 +02:00
Gunnar Skjold
0a08767c9b Iskra proprietary fix 2023-07-31 08:53:59 +02:00
Gunnar Skjold
49fd79f367 Fixed fetching prices just after midnight 2023-07-30 16:32:54 +02:00
Gunnar Skjold
1ba168b268 Added frame data 2023-07-30 16:27:51 +02:00
Gunnar Skjold
c765746c62 Fixed clock issue after midnight 2023-07-30 16:27:37 +02:00
Gunnar Skjold
e8016025d8 Added special Iskra data 2023-07-30 16:12:44 +02:00
Conrad Juhl Andersen
7cbcbd4bc8 Added support for getting accumulated energy for phases (Kamstrup) 2023-07-20 13:04:27 +02:00
Gunnar Skjold
4a3d884526 Disable TX pin on HAN port 2023-07-11 16:43:06 +02:00
Gunnar Skjold
9c25eaff55 Merge pull request #607 from dbeinder/ui_compress
Pre-compress index JS/CSS with gzip
2023-07-09 20:39:20 +02:00
david-beinder
76f09b306a Pre-compress index JS/CSS with gzip 2023-07-06 01:20:53 +02:00
david-beinder
7c5a1b1fb8 Add option to disable 802.11b data rates 2023-07-05 23:49:53 +02:00
ArnieO
84fe477783 Add files via upload
Mottatt Omnia E-meter User guide fra Kamstrup.
2023-07-05 14:03:36 +02:00
Gunnar Skjold
4b34df091c Removed handshake timeout as reason for AP mode 2023-07-03 15:46:12 +02:00
Gunnar Skjold
7aa7f6adc6 Fixed display of cost when all turns negative 2023-07-03 08:58:32 +02:00
Gunnar Skjold
c462b3bb00 Fixed clock skew on graphs around midnight 2023-07-02 14:51:57 +02:00
Gunnar Skjold
4f90954084 Fixed scaling issue on graphs 2023-07-02 14:03:06 +02:00
Gunnar Skjold
1132db9bfa Only switch to AP mode on WiFi connection error if user have never visited GUI (first setup) 2023-07-02 13:57:22 +02:00
Gunnar Skjold
9d09c619e4 Removed unused label 2023-07-02 13:55:46 +02:00
Gunnar Skjold
78891e8d33 Save buffer size 2023-07-02 13:54:04 +02:00
Gunnar Skjold
e629bb0d68 Configurable buffer size and patch of GUI dependencies 2023-07-02 13:43:45 +02:00
Gunnar Skjold
ca1c237776 Swap to AP mode if WiFi psk is wrong 2023-06-11 09:45:17 +02:00
Gunnar Skjold
5b6b9879b1 Switch to subunit of currency if price is low 2023-06-11 08:54:03 +02:00
Gunnar Skjold
06a0366762 Fixed negative month cost in realtime calculation 2023-06-11 08:20:09 +02:00
Gunnar Skjold
538624b6eb Fixed wrong date 2023-06-11 08:08:33 +02:00
Gunnar Skjold
4496b958ff Fixed overlapping labels in graph 2023-06-11 08:03:07 +02:00
Gunnar Skjold
b2a93c0b4c Changed label for monthplot 2023-06-11 07:06:03 +02:00
Gunnar Skjold
2cbe566910 Fixed mouseover label on prices for "tomorrow" 2023-06-11 06:59:07 +02:00
Gunnar Skjold
a4b07f4097 Merge branch 'master' of github.com:UtilitechAS/amsreader-firmware 2023-06-11 06:53:17 +02:00
Gunnar Skjold
f8cb9d187f Adjusted retry delay on prices 2023-06-11 06:41:46 +02:00
Gunnar Skjold
5e9fe74dd0 Merge pull request #586 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/vite-3.2.7
Bump vite from 3.0.9 to 3.2.7 in /lib/SvelteUi/app
2023-06-06 10:58:24 +02:00
dependabot[bot]
5b7b30c0d0 Bump vite from 3.0.9 to 3.2.7 in /lib/SvelteUi/app
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 3.0.9 to 3.2.7.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v3.2.7/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v3.2.7/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-06 02:25:27 +00:00
Gunnar Skjold
9d902c63de Fixed NPE 2023-05-22 12:51:26 +02:00
Gunnar Skjold
a57405a7a5 Fixed NaN in clock 2023-05-22 10:26:12 +02:00
Gunnar Skjold
550d32ee33 Fixed issue with new device 2023-05-22 09:55:15 +02:00
Gunnar Skjold
9f7e174c7b Updated code that fixes broken DNS on IPv6 networks 2023-05-21 13:50:05 +02:00
Gunnar Skjold
104617afd2 Use device timezone in gui 2023-05-21 12:34:00 +02:00
Gunnar Skjold
959664f61d Even more changes for negative prices 2023-05-21 12:10:00 +02:00
Gunnar Skjold
5834b07393 Adjustments to avoid dns resolving in a closed network 2023-05-20 22:03:26 +02:00
Gunnar Skjold
8dbcf2424a Hack to fix DNS on networks with IPv6 2023-05-20 21:59:18 +02:00
Gunnar Skjold
74345046b1 Adjustments for negative prices 2023-05-20 21:58:57 +02:00
Gunnar Skjold
516c80e38c Fixed negative and 0 price 2023-05-16 22:04:51 +02:00
Gunnar Skjold
17bbac8670 Updated exchange rate api call 2023-05-05 19:34:48 +02:00
Gunnar Skjold
ccee3f505d Changes after testing 2023-05-05 18:30:30 +02:00
Gunnar Skjold
48eb640838 Changes after testing 2023-05-05 18:12:26 +02:00
Gunnar Skjold
90ebe3803d More adaptations 2023-05-04 17:31:16 +02:00
Gunnar Skjold
07ff4e2b0c Added last month in realtime data. Also increased precision on realtime data 2023-05-04 14:33:14 +02:00
Gunnar Skjold
7e011a184b Added delay for stability purposes 2023-05-04 12:12:08 +02:00
Gunnar Skjold
324459df97 Reduce verbose debug 2023-05-04 12:02:16 +02:00
Gunnar Skjold
2db38835c5 Fixed errors in SVG 2023-05-04 11:58:39 +02:00
Gunnar Skjold
804e43824b Fixed data storage update 2023-05-04 11:44:22 +02:00
Gunnar Skjold
60c7cea724 Extended range for multipliers 2023-05-03 07:51:11 +02:00
Gunnar Skjold
b9fe6cab83 Improved on automatic clearing of graph 2023-05-02 14:21:58 +02:00
Gunnar Skjold
e3f41fdb4c Fixed issue introduced in previous commit 2023-05-02 14:02:40 +02:00
Gunnar Skjold
9e5cb48101 Improved update and clearing of hour/day in data storage for graphs 2023-05-02 13:39:16 +02:00
Gunnar Skjold
259d8424a3 Merge pull request #550 from dbeinder/version_lib
Speedup build
2023-05-02 10:51:26 +02:00
david-beinder
a6ae86abb8 Remove redundant 'typedef'
'typedef' is not needed in C++ and generates a warning
2023-05-02 10:48:54 +02:00
david-beinder
a23abf626b Convert Arduino sketch to C++ 2023-05-02 10:48:54 +02:00
david-beinder
849eac1c0f Move version constants into its own compile-unit
Speeds up the build by moving those constants into a separate compile-unit.
Currently, since the version header is auto regenerated on each build,
all modules that include it, also have to be recompiled every time.
2023-05-02 10:48:53 +02:00
Gunnar Skjold
13dda2bb19 Added decimals on month plot if number under 10. Also added mouse-over with better precision 2023-05-02 10:40:53 +02:00
Gunnar Skjold
eea1782280 Fixed segfault when enabling verbose debug with fixed price 2023-05-02 10:20:54 +02:00
Gunnar Skjold
d729d0c5bd Fixed update of data in month plot after entering new month 2023-05-02 10:15:31 +02:00
Gunnar Skjold
72cc0996e1 Merge branch 'master' of github.com:UtilitechAS/amsreader-firmware 2023-04-29 06:40:32 +02:00
Gunnar Skjold
b1ad844bc6 Fixed reactive energy sensors in HA 2023-04-29 06:40:25 +02:00
Gunnar Skjold
4977ad3471 Merge pull request #548 from dbeinder/fixedprice
Add backup, restore, clearing of 'fixedPrice' setting
2023-04-29 06:16:02 +02:00
david-beinder
a3dcd2cfb2 Add backup, restore, clearing of 'fixedPrice' 2023-04-28 22:46:44 +02:00
Gunnar Skjold
c1701c8ee9 Fixed c3 bootloader 2023-04-28 19:32:54 +02:00
Gunnar Skjold
1e88148971 Fixed flash script 2023-04-28 18:42:49 +02:00
Gunnar Skjold
cef7ed15cb Merge pull request #543 from UtilitechAS/dependabot/npm_and_yarn/lib/SvelteUi/app/yaml-2.2.2
Bump yaml from 2.1.1 to 2.2.2 in /lib/SvelteUi/app
2023-04-28 18:37:53 +02:00
dependabot[bot]
7c93537fef Bump yaml from 2.1.1 to 2.2.2 in /lib/SvelteUi/app
Bumps [yaml](https://github.com/eemeli/yaml) from 2.1.1 to 2.2.2.
- [Release notes](https://github.com/eemeli/yaml/releases)
- [Commits](https://github.com/eemeli/yaml/compare/v2.1.1...v2.2.2)

---
updated-dependencies:
- dependency-name: yaml
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-04-25 20:32:45 +00:00
Gunnar Skjold
8b97544a2c Remove old Kaifa special case code 2023-04-25 11:53:58 +02:00
Gunnar Skjold
a5f872a86c More timezone adjustments after testing 2023-04-25 08:09:47 +02:00
Gunnar Skjold
6e8233e4af Fixed timestamp from meter 2023-04-24 15:46:56 +02:00
Gunnar Skjold
d85d68b4a6 Hide firmware upgrade when no upgrade 2023-04-24 15:46:34 +02:00
Gunnar Skjold
ed9cf4b87d Fixed NTP 2023-04-24 15:26:31 +02:00
Gunnar Skjold
39e86fa180 Show only half the labels on small screens 2023-04-21 18:55:15 +02:00
Gunnar Skjold
5d278a9d5a Splitting loop into smaller methods 2023-04-19 15:12:49 +02:00
Gunnar Skjold
61040e3e7c Crossing fingers 2023-04-18 22:06:29 +02:00
Gunnar Skjold
c4005f10a3 Some debugging changes and other optimizations 2023-04-18 11:50:44 +02:00
Gunnar Skjold
7bed5add5d Fix 2023-04-17 21:44:36 +02:00
Gunnar Skjold
18e382f21f Fix 2023-04-17 21:41:20 +02:00
Gunnar Skjold
94865b632e Some more optimization 2023-04-17 21:33:00 +02:00
Gunnar Skjold
f0461a7cdb Some adjustments 2023-04-17 11:49:22 +02:00
Gunnar Skjold
4cd6013d64 More improvements on buffer 2023-04-15 20:51:35 +02:00
Gunnar Skjold
b06dbb8d79 Buffer improvements and fixed special characters in ssid 2023-04-15 20:38:26 +02:00
Gunnar Skjold
02fe2073c2 Better error handling for price api 2023-04-15 09:30:19 +02:00
Gunnar Skjold
ec7ceafa84 General optimizations 2023-04-15 09:14:25 +02:00
Gunnar Skjold
276ac67d2e Only clear HA config if illegal characters are loaded from flash 2023-04-15 07:47:48 +02:00
Gunnar Skjold
be116d5b35 Improved firmware upgrade 2023-04-15 07:44:33 +02:00
Gunnar Skjold
9c8788225d Clear HA or domoticz config if not in use 2023-04-15 06:06:26 +02:00
Gunnar Skjold
df44b05792 Clear HA conf by default 2023-04-13 10:20:15 +02:00
Gunnar Skjold
8ee8eee6c4 Fixed laout error on realtime data 2023-04-10 14:14:20 +02:00
Gunnar Skjold
28e13b73e6 Fixed missing HA sensors 2023-04-10 14:08:41 +02:00
Gunnar Skjold
088e5645c7 Increased RX serial buff 2023-04-07 09:00:53 +02:00
Gunnar Skjold
3e3d61912d Serial debugging 2023-04-07 08:39:36 +02:00
Gunnar Skjold
b7854baa6d Some HAN serial port debugging 2023-04-07 08:36:42 +02:00
Gunnar Skjold
68bbfd6527 Load data before restoring from config file 2023-04-05 07:54:59 +02:00
Gunnar Skjold
c1ca3d0c65 Fixed month number in clock 2023-04-03 07:07:44 +02:00
Gunnar Skjold
71cac46470 Config restore loads username into password field 2023-04-03 07:06:18 +02:00
Gunnar Skjold
700f023292 Possibility to specify fixed energy price 2023-04-01 10:57:21 +02:00
Gunnar Skjold
ea43b2b632 Some changes after testing new HA features 2023-04-01 10:43:55 +02:00
Gunnar Skjold
c456e3fdf1 Fixed config loading for ha 2023-04-01 08:20:41 +02:00
Gunnar Skjold
4947f0ec7f Clear HA config in next config version 2023-04-01 08:02:12 +02:00
Gunnar Skjold
799c2f19d9 Changes after uahn merge 2023-04-01 08:00:15 +02:00
Gunnar Skjold
18dc188835 Merge pull request #481 from dbeinder/mosquito
Add HAN pullup config and mosquito board
2023-04-01 07:43:34 +02:00
Gunnar Skjold
7db745829e Merge branch 'master' into mosquito 2023-04-01 07:43:24 +02:00
Gunnar Skjold
81fedaaa6a Moved from postfix to prefix on HA sensor name tag 2023-04-01 07:38:24 +02:00
Gunnar Skjold
71e0f13f0e Various changes after testing new HA features 2023-04-01 07:31:40 +02:00
Gunnar Skjold
f214af3595 Added price API rate limit error 2023-03-31 13:57:38 +02:00
Gunnar Skjold
fb9ae2f5f6 Updated boot reason descriptions 2023-03-31 13:52:22 +02:00
Gunnar Skjold
4c73f39214 Fixed state class on sensors 2023-03-31 13:49:02 +02:00
Gunnar Skjold
1e7176af0b HA configuration 2023-03-30 14:54:10 +02:00
Gunnar Skjold
0d8c88b1fc Fixed DST 25hr day error on month plot 2023-03-30 12:25:07 +02:00
Gunnar Skjold
d189d904fe Fixed edge case where graph data sometimes goes crazy 2023-03-30 11:55:39 +02:00
Gunnar Skjold
3c86e824a2 Added boot time to status page 2023-03-30 09:44:41 +02:00
Gunnar Skjold
061f6433d6 Added another proprietary L&G 2023-03-30 09:00:12 +02:00
Gunnar Skjold
0d923e30d6 Added another proprietary L&G 2023-03-30 08:59:56 +02:00
Gunnar Skjold
51f761d25e Fixed incorrect change of HA current hour/day/month kwh state class 2023-03-29 08:53:13 +02:00
Gunnar Skjold
58fec70e7c Added detection for Kaifa through system title 2023-03-27 09:20:16 +02:00
Gunnar Skjold
dff55b4eee Remove copy/paste l2current substitution from DSMR parser 2023-03-27 08:46:41 +02:00
Gunnar Skjold
931f0d400b Only publish prices once when fetching today and tomorrow at the same time 2023-03-26 15:24:55 +02:00
Gunnar Skjold
0178dc4184 Various fixes for HA 2023-03-26 15:12:24 +02:00
Gunnar Skjold
be522b40f9 Fixed swapped voltage ranges, esp32 vs esp8266 2023-03-26 10:52:01 +02:00
Gunnar Skjold
068c55e7bb Fixed disabling encryption 2023-03-26 10:49:00 +02:00
Gunnar Skjold
8e88d7e11b Show boot reason on status page 2023-03-26 10:40:02 +02:00
Gunnar Skjold
e36acef1d4 Fixed DST offset in day graph 2023-03-26 10:14:10 +02:00
Gunnar Skjold
07d5481a72 Actual fix for DST change 2023-03-26 10:06:37 +02:00
Gunnar Skjold
dbd6205cca Fixed issue with price graph in relation to entering or leaving DST 2023-03-25 19:14:21 +01:00
david-beinder
35d47902c6 Add HAN pullup config and mosquito board 2023-03-18 23:39:55 +01:00
Gunnar Skjold
938f9f69d1 Fixed memory leak in baud autodetect 2023-03-11 10:17:44 +01:00
Gunnar Skjold
cd27472e2d Fixed checkbox tick and changed backup/restore label 2023-03-11 09:19:09 +01:00
Gunnar Skjold
64f8414217 Fixed precision on domoticz energy counter 2023-03-11 08:53:51 +01:00
Gunnar Skjold
a2c1250724 Some updates for esp32c3 2023-02-27 09:00:07 +01:00
Gunnar Skjold
4b7160b502 Only report realtime data on MQTT if EnergyAccounting is initialized 2023-02-27 08:30:56 +01:00
Gunnar Skjold
cc50457404 Fixed spikes in realtime production on top of hour 2023-02-27 08:04:29 +01:00
Gunnar Skjold
cd48192a74 Removed classic UI 2023-02-22 18:09:16 +01:00
Gunnar Skjold
cd031c33aa Added forced 2400 baud for Pow-K 2023-02-22 07:12:54 +01:00
Gunnar Skjold
6c59b15681 Added esp32c3 release build 2023-02-22 07:07:51 +01:00
Gunnar Skjold
7c8593122b Removed forced baud rate 2023-02-22 07:07:31 +01:00
Gunnar Skjold
6d8fd4e083 Merge pull request #460 from dbeinder/c3-generic-boards
Add generic boards for ESP32-C3
2023-02-22 06:56:09 +01:00
david-beinder
79d674710f Add generic boards for ESP32-C3 2023-02-21 23:25:14 +01:00
Gunnar Skjold
062068eacd Increased range of tariff thresholds 2023-02-21 15:29:10 +01:00
Gunnar Skjold
98309ea532 Allow extended ascii in ssid 2023-02-21 13:55:38 +01:00
Gunnar Skjold
0f75fa4a58 Fixed redirect issue after initial setup with DHCP on ESP8266 2023-02-21 13:40:55 +01:00
Gunnar Skjold
d08f75d9c3 Fixed error changing from static ip to dhcp 2023-02-21 12:44:43 +01:00
Gunnar Skjold
dd4a43c831 Better feedback from entso-e 2023-02-21 07:54:11 +01:00
Gunnar Skjold
1f5a04e606 Increased range for instant values 2023-02-14 20:23:23 +01:00
Gunnar Skjold
4d6e63a171 Fixed GPIO HAN select for ESP8266 2023-02-12 20:48:38 +01:00
Gunnar Skjold
0093410e05 Removed kicad backup 2023-02-10 18:57:50 +01:00
Gunnar Skjold
ee63a606e8 Fixed voltage read issue 2023-02-10 18:55:55 +01:00
Gunnar Skjold
d0ccd2d007 Minor ui adjustment 2023-02-10 17:28:19 +01:00
Gunnar Skjold
bb2f74d1ca Various UI improvements 2023-02-06 18:20:48 +01:00
Gunnar Skjold
dfef18fa09 Updated Entsoe endpoint 2023-02-06 11:32:53 +01:00
Gunnar Skjold
485c21dc69 Removed unnecessary build flag 2023-02-06 10:59:40 +01:00
Gunnar Skjold
9ceb84bc9c C3 build 2023-02-06 07:46:34 +01:00
Gunnar Skjold
24e68428c4 Commited gui dist files 2023-02-05 19:26:48 +01:00
Gunnar Skjold
c2c5855e6a Fixed issue where authentication key got corrupted from configfile upload 2023-02-02 16:15:03 +01:00
Gunnar Skjold
de19de2129 Fixed incorrect change in previous commit 2023-02-01 19:00:50 +01:00
Gunnar Skjold
1719263de0 Fixed config migration issue from v2.1 2023-02-01 18:46:22 +01:00
Gunnar Skjold
e70b872c98 Removed v2.0 config loading 2023-02-01 18:46:06 +01:00
Gunnar Skjold
b7d28238ab Extended cache for js and css 2023-01-31 17:16:18 +01:00
Gunnar Skjold
6c9a8b0692 Label fix 2023-01-31 17:04:46 +01:00
Gunnar Skjold
9f3dba3aab Fixed reconnect after setup 2023-01-30 20:58:08 +01:00
Gunnar Skjold
e4e4ad4107 Fixed autodetect 2023-01-30 18:32:17 +01:00
Gunnar Skjold
e8fb9570bb Chasing a reboot bug... 2023-01-30 16:52:12 +01:00
Gunnar Skjold
bc42099962 Fixing some bug reports 2023-01-30 16:07:08 +01:00
Gunnar Skjold
be71cbe609 Some changes after bug reports 2023-01-30 12:02:23 +01:00
Gunnar Skjold
0d6df03c94 Fixed reboot loop, changed temperature sensor behaviour and changed some debugging 2023-01-29 22:45:35 +01:00
Gunnar Skjold
d777040c0a Fixed loading error from previous version energy accounting 2023-01-29 17:04:04 +01:00
Gunnar Skjold
a5636a60f8 Some changes after testing 2023-01-28 20:24:18 +01:00
Gunnar Skjold
6f817b2ed5 Some changes after testing 2023-01-28 20:19:06 +01:00
Gunnar Skjold
e4fec4f4c2 Some final changes 2023-01-28 11:53:26 +01:00
Gunnar Skjold
3a25964ec4 Merge pull request #412 from UtilitechAS/dev-v2.2
v2.2
2023-01-28 10:54:20 +01:00
Gunnar Skjold
1227dff412 Changed autocomplete in setup form 2023-01-26 19:55:39 +01:00
Gunnar Skjold
26ee2e6efc Some changes after testing + changing hostname for hub 2023-01-26 19:42:19 +01:00
Gunnar Skjold
d6a8d31278 Some updates for documentation 2023-01-23 18:19:33 +01:00
Gunnar Skjold
3f2b534baa Merge branch 'master' into dev-v2.2 2023-01-23 13:59:38 +01:00
Gunnar Skjold
70f413013c Merge pull request #408 from aadnehovda/patch-1
Unknown HA entity units.
2023-01-23 13:57:33 +01:00
Ådne Hovda
6edcd174bb Unknown HA entity units.
It appears that HA units are case sensitive: https://developers.home-assistant.io/docs/core/entity/sensor/, so for SensorDeviceClass.REACTIVE_POWER it should be "var", not "VAr". Also for SensorDeviceClass.TEMPERATURE, the degree symbol is required: "°C".

    Entity sensor.ams_ed6e_qo (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'VAr' which is not a valid unit for the device class ('reactive_power') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
    Entity sensor.ams_ed6e_q (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'VAr' which is not a valid unit for the device class ('reactive_power') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
    Entity sensor.ams_ed6e_tqo (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'kVArh' which is not a valid unit for the device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
    Entity sensor.ams_ed6e_tqi (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) is using native unit of measurement 'kVArh' which is not a valid unit for the device class ('energy') it is using; Please update your configuration if your entity is manually configured, otherwise create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+mqtt%22
2023-01-23 11:09:47 +01:00
Gunnar Skjold
3170ef6ce9 c3 scripts 2023-01-21 13:45:47 +01:00
Gunnar Skjold
fb56f4d012 More changes for repo 2023-01-21 13:45:09 +01:00
Gunnar Skjold
c5756f0cba Renamed repo 2023-01-21 13:43:11 +01:00
Gunnar Skjold
95c9ecc8b2 Merge branch 'master' into dev-v2.2 2023-01-18 21:14:49 +01:00
Gunnar Skjold
bdee066c33 Fixed reboot loop 2023-01-18 21:14:40 +01:00
Gunnar Skjold
957039d0c0 Merge branch 'master' into dev-v2.2 2023-01-18 20:48:38 +01:00
Gunnar Skjold
dd23a0fa60 Fixed reboot look 2023-01-18 20:48:27 +01:00
Gunnar Skjold
7777a0a059 Merge branch 'master' into dev-v2.2 2023-01-18 17:11:10 +01:00
Gunnar Skjold
e8fc6d48bf Fixed issue where GPIO setup becomes invalid 2023-01-18 17:11:01 +01:00
Gunnar Skjold
c98148c886 Update readme 2023-01-17 19:56:28 +01:00
Gunnar Skjold
6ba2b4060e Update images for readme and wiki 2023-01-17 19:55:00 +01:00
Gunnar Skjold
762c17ca8e Updated readme and example ini file 2023-01-17 19:48:24 +01:00
Gunnar Skjold
fad6ada1e0 Updated release 2023-01-17 19:15:57 +01:00
Gunnar Skjold
fb1d343ee3 Removed debugging 2023-01-17 19:03:07 +01:00
Gunnar Skjold
1f3c32e80a Adding secrets to build 2023-01-17 18:57:11 +01:00
Gunnar Skjold
43fbca7099 Update release build 2023-01-17 18:42:09 +01:00
Gunnar Skjold
7a36082564 Trying stuff to get build working 2023-01-17 18:34:47 +01:00
Gunnar Skjold
fb2cfdfe01 Trying to fix build 2023-01-17 18:28:08 +01:00
Gunnar Skjold
6c3dca9344 Updated build 2023-01-17 18:15:32 +01:00
Gunnar Skjold
cce5d75fd7 Updated build 2023-01-17 18:13:54 +01:00
Gunnar Skjold
8fd411c1d6 Updated build 2023-01-17 18:13:20 +01:00
Gunnar Skjold
4b15ac74fc Update FUNDING.yml 2023-01-17 18:05:44 +01:00
Gunnar Skjold
508b2e6c45 Icon for safari 2023-01-17 17:51:50 +01:00
Gunnar Skjold
af630615db Changes after testing 2023-01-17 17:49:01 +01:00
Gunnar Skjold
222a4f13e2 Changes after testing 2023-01-17 17:48:42 +01:00
Gunnar Skjold
3bc6c75c5a Some more changes for L&G 2023-01-15 11:20:28 +01:00
Gunnar Skjold
dbb3eac709 Some changes for L&G 2023-01-15 10:56:46 +01:00
Gunnar Skjold
1cee48eab4 Some design changes 2023-01-14 09:34:28 +01:00
Gunnar Skjold
c28752a00a Fixed firmware upgrade 2023-01-12 21:24:36 +01:00
Gunnar Skjold
365061df29 Some changes after testing 2023-01-12 20:17:37 +01:00
Gunnar Skjold
870617f780 More changes for v2.2 2023-01-11 20:41:27 +01:00
Gunnar Skjold
4972b980ba Changes for v2.2 2023-01-06 14:34:07 +01:00
Gunnar Skjold
51c70abda3 Merge branch 'master' into dev-v2.2 2023-01-04 18:55:38 +01:00
Gunnar Skjold
8d448533c7 Fixed config export for esp32 2022-12-19 18:36:04 +01:00
Gunnar Skjold
43cb9a0000 Fixed DSMR CRC check 2022-12-19 18:14:12 +01:00
Gunnar Skjold
d49b7eac09 Minor change 2022-12-19 16:49:40 +01:00
Gunnar Skjold
8f057e687c Merge pull request #387 from lassebm/lg-e360-fixes
Landis+Gyr E360 fixes
2022-12-19 16:45:52 +01:00
Lasse Bang Mikkelsen
5b4f680114 Align Landis+Gyr naming 2022-12-17 12:38:18 +01:00
Lasse Bang Mikkelsen
fabdfbadf4 Add support for Landis+Gyr meters using "LGF" manufacturer ID 2022-12-16 20:20:40 +01:00
Lasse Bang Mikkelsen
afa47ea633 Use list type 4 when phase active import/export power is available 2022-12-16 20:19:15 +01:00
Gunnar Skjold
461d76e651 Merge branch 'master' into dev-v2.2 2022-12-15 18:32:36 +01:00
Gunnar Skjold
c40e20c8e9 Extract active import/export per phase from DSMR 2022-12-15 18:25:13 +01:00
Gunnar Skjold
4e97554514 Some changes during testing 2022-12-14 19:37:32 +01:00
Gunnar Skjold
28a9d6746b Fixed discover when setting different hostname in setup 2022-12-14 18:15:46 +01:00
Gunnar Skjold
7ea4fe881c HAN serial autodetect 2022-12-13 21:05:42 +01:00
Gunnar Skjold
c4eaf8184b Check if authenticated to show upgrade links and config up/download 2022-12-10 09:27:18 +01:00
Gunnar Skjold
312972f77d Some improvements to v2.2 2022-12-09 20:26:48 +01:00
Gunnar Skjold
27b9058af5 Some improvements to v2.2 2022-12-09 20:26:31 +01:00
Gunnar Skjold
bc4d61098c Some error handling 2022-12-09 19:10:24 +01:00
Gunnar Skjold
b2de6472cf Some experiments with captive portal 2022-12-09 18:24:43 +01:00
Gunnar Skjold
6c3ddc57b5 Removed "auto multiplier" for Kamstrup 2022-12-08 13:44:21 +01:00
Gunnar Skjold
2ff7044c85 Fixed incorrect value for peaks in MQTT 2022-12-07 20:13:30 +01:00
Gunnar Skjold
0145be851e Merge branch 'master' into dev-v2.2 2022-12-07 20:11:14 +01:00
Gunnar Skjold
6b0d540f39 Added 300 baud 2022-12-07 11:51:45 +01:00
Gunnar Skjold
2218ac4e8a Fixed graph clearing problem 2022-12-07 11:32:55 +01:00
Gunnar Skjold
33bd3da310 Various fix for realtime values 2022-12-06 15:45:43 +01:00
Gunnar Skjold
a239e1a63d Fix on special case for Kaifa MA304T3 2022-12-06 08:28:30 +01:00
Gunnar Skjold
8a809ec128 Bugfix from testing 2022-12-04 14:32:47 +01:00
Gunnar Skjold
b48a0f13fe More v2.2 2022-12-04 14:12:35 +01:00
Gunnar Skjold
b07ed075f4 Even more v2.2 2022-12-02 20:38:56 +01:00
Gunnar Skjold
0927cab8e2 Some changes for fetching prices from amshub 2022-12-02 19:24:53 +01:00
Gunnar Skjold
eed35b7bbc Merge branch 'hub-prices' into dev-v2.2 2022-12-02 19:08:29 +01:00
Gunnar Skjold
e34da5fd83 Merge branch 'master' into hub-prices 2022-12-02 19:04:14 +01:00
Gunnar Skjold
148fb14c93 More v2.2 2022-12-02 19:03:16 +01:00
Gunnar Skjold
000cfd8697 Merge branch 'master' into dev-v2.2 2022-12-01 18:12:32 +01:00
Gunnar Skjold
1ef5703971 Fixed changing mdns settings 2022-12-01 18:06:19 +01:00
Gunnar Skjold
cda3b80b35 Some changes 2022-11-29 21:24:58 +01:00
Gunnar Skjold
c7b8090634 Some minor changes 2022-11-29 21:02:23 +01:00
Gunnar Skjold
63a8d79b95 Making it work on 8266 2022-11-29 20:50:36 +01:00
Gunnar Skjold
02ae3fc7f5 More v2.2 2022-11-29 20:20:56 +01:00
Gunnar Skjold
2dcc874592 More v2.2 2022-11-25 19:18:32 +01:00
Gunnar Skjold
d4d9d2224f More v2.2 2022-11-23 20:52:37 +01:00
Gunnar Skjold
902e43979b Even more v2.2 2022-11-21 18:48:04 +01:00
Gunnar Skjold
8e54f23367 More v2.2 2022-11-20 20:47:29 +01:00
Gunnar Skjold
ab7128c53a Further work on v2.2 2022-11-19 15:44:23 +01:00
Gunnar Skjold
6563700df4 Merge branch 'master' into dev-v2.2 2022-11-15 18:07:02 +01:00
Gunnar Skjold
538de5ea99 Increased range of multipliers 2022-11-08 18:41:31 +01:00
Gunnar Skjold
042e2bcc85 Fixed power saving 2022-11-07 14:57:53 +01:00
Gunnar Skjold
b6f630b134 Some more Svelte implementation 2022-11-01 20:59:38 +01:00
Gunnar Skjold
65a09dcecf Merge branch 'master' into dev-v2.2 2022-11-01 19:07:00 +01:00
Gunnar Skjold
775e5a0881 Support different size numbers in L&G payload 2022-11-01 18:41:43 +01:00
Gunnar Skjold
6c0d5fcc09 Some adjustments to wifi power saving option 2022-10-31 10:09:07 +01:00
Gunnar Skjold
69d8fa9254 Made wifi sleep mode configurable 2022-10-27 19:17:50 +02:00
root
71d261bf34 Merge branch 'hub-prices' of github.com:gskjold/AmsReader into hub-prices 2022-10-23 19:11:51 +02:00
root
9f4f5b4620 Merge branch 'master' into hub-prices 2022-10-23 19:09:15 +02:00
Gunnar Skjold
c38c305bab Fixed threshold update via config file 2022-10-21 19:21:55 +02:00
Gunnar Skjold
bfee2a1d64 Fixed month average calculation 2022-10-21 18:43:30 +02:00
Gunnar Skjold
ec7edae9a1 Updated issue templates 2022-10-21 17:43:33 +02:00
Gunnar Skjold
d8e265b7ac Fixed JSON errors 2022-10-20 20:12:33 +02:00
Gunnar Skjold
1987cddab7 Some more cleanup 2022-10-20 20:11:13 +02:00
Gunnar Skjold
e18be5f97c Better memory optimization 2022-10-19 20:58:57 +02:00
Gunnar Skjold
537597d6d1 Expanding size of daily and monthly data points 2022-10-19 20:30:29 +02:00
Gunnar Skjold
a89013cec3 Fixed config file upload 2022-10-19 20:24:21 +02:00
Gunnar Skjold
9c7a0cb7ff Fixed graph error 2022-10-19 19:59:41 +02:00
Gunnar Skjold
ade12199b9 Reclaiming some heap space 2022-10-19 19:54:26 +02:00
Gunnar Skjold
92692c6eaf More implementation of Svelte GUI 2022-10-18 20:52:42 +02:00
Gunnar Skjold
e4114c3e74 Merge branch 'master' into dev-v2.2 2022-10-18 18:30:37 +02:00
Gunnar Skjold
39b68aca51 Removed invalid code 2022-10-18 18:30:26 +02:00
root
feffbb53a3 Merge branch 'master' of github.com:gskjold/AmsToMqttBridge into hub-prices 2022-10-17 15:42:23 +02:00
Gunnar Skjold
8ac1e034b1 Reverted WiFi_connect method 2022-10-17 13:09:28 +02:00
Gunnar Skjold
f446dff865 Fixed LED blink delay 2022-10-17 13:09:04 +02:00
root
e1b2554af2 Merge branch 'master' of github.com:gskjold/AmsToMqttBridge into hub-prices 2022-10-16 18:46:47 +02:00
Gunnar Skjold
627a50ab50 Fixed priceapi dropdowns 2022-10-16 18:46:31 +02:00
Gunnar Skjold
a20d007b45 Merge branch 'hub-prices' of github.com:gskjold/AmsReader into hub-prices 2022-10-16 18:32:25 +02:00
Gunnar Skjold
64840e13f0 Merge branch 'master' into hub-prices 2022-10-16 18:31:26 +02:00
Gunnar Skjold
34ebe9601a Changed blink behaviour 2022-10-16 18:31:11 +02:00
root
72f1d59338 Merge branch 'hub-prices' of github.com:gskjold/AmsReader into hub-prices 2022-10-16 17:36:48 +02:00
Gunnar Skjold
07ed425320 Merge branch 'master' into hub-prices 2022-10-16 17:34:19 +02:00
Gunnar Skjold
2e75e1c4dc Moved HA files 2022-10-13 20:58:08 +02:00
Gunnar Skjold
e6df68481f Merge branch 'master' into dev-v2.2 2022-10-13 20:47:48 +02:00
Gunnar Skjold
fa299198fc Fixed all build warnings 2022-10-13 20:33:59 +02:00
Gunnar Skjold
6d81b0a856 Fixed all build warnings 2022-10-13 20:24:56 +02:00
Gunnar Skjold
dd095da97b Reduced footprint of GPIO config page 2022-10-13 19:27:25 +02:00
Gunnar Skjold
1b6ce203b7 Better debug output whem receiving unknown data 2022-10-13 17:40:44 +02:00
Gunnar Skjold
2850be4e48 Merge pull request #322 from tbarnekov/extend_power_info
Populate Active Import and Export per phase and export to HA
2022-10-12 20:34:09 +02:00
Gunnar Skjold
7eca31de84 Fixed build errors 2022-10-12 20:01:55 +02:00
Gunnar Skjold
a64f960cc7 Added Pow-U+ profile 2022-10-12 19:30:00 +02:00
Gunnar Skjold
ce3a47a7e6 Fixed error blinks and improved WiFi reconnect 2022-10-12 19:25:48 +02:00
Thomas Barnekov
8395e1dc77 Merge remote-tracking branch 'origin/master' into extend_power_info 2022-10-10 17:06:09 +02:00
Thomas Barnekov
39a4761415 Add DOCTYPE to html to fix quirks mode 2022-10-10 16:59:43 +02:00
root
dc25c147b9 Merge remote-tracking branch 'public/master' into hub-prices 2022-10-07 17:36:49 +00:00
Gunnar Skjold
867ab9d6c2 Build variable for upgrade URL 2022-10-07 19:35:30 +02:00
Gunnar Skjold
6a76144566 Merge branch 'master' into hub-prices 2022-10-07 17:49:47 +02:00
Thomas Barnekov
5e03e3d3c2 Move per-phase power consumption and power factor values to new ha4.json 2022-10-07 13:40:29 +02:00
Thomas Barnekov
adb5050621 Merge branch 'gskjold:master' into extend_power_info 2022-10-06 17:31:43 +02:00
Gunnar Skjold
026cd25c8c Setting modem sleep to max 2022-10-06 17:30:37 +02:00
Gunnar Skjold
06ec97b42a Make sure we dont use more than 5 peaks if defined higher 2022-10-06 17:20:13 +02:00
Gunnar Skjold
b420a0e6f4 Limit peak count if over 5 2022-10-06 17:12:12 +02:00
Thomas Barnekov
7cd52d5689 Add individual power reading for all phases (include in HA) 2022-10-06 00:35:30 +02:00
Thomas Barnekov
ad78ff3082 Fix implicit cast and non-const char pointer warnings 2022-10-05 22:42:43 +02:00
Gunnar Skjold
fe7be81f1e Rudimentary detection for L&G data. Probably change this in the future 2022-10-01 12:11:46 +02:00
Gunnar Skjold
7674fc2ad0 Merge branch 'lng-parser' 2022-10-01 11:56:08 +02:00
Gunnar Skjold
d50181c347 Upgrade with custom URL 2022-10-01 11:43:42 +02:00
Gunnar Skjold
8ca771fa5a Changed "BUS" to "M-BUS" 2022-10-01 09:25:56 +02:00
Gunnar Skjold
7d557b2679 Only show new version when actually new in firmware page. Also be more specific on USB power in upgrade warning 2022-10-01 09:24:07 +02:00
Gunnar Skjold
2f0c912388 Exclude decimals in BUILD_EPOCH flag 2022-10-01 09:22:09 +02:00
Gunnar Skjold
57e6d0fbe3 Modifications to make price sensors work in HA 2022-09-30 19:18:23 +02:00
Gunnar Skjold
e7c25fafda Prices and realtime HA sensors 2022-09-28 20:13:03 +02:00
Gunnar Skjold
2a4772fe25 Fixed memory leak when reconnecting to MQTT/SSL 2022-09-27 19:59:37 +02:00
Gunnar Skjold
f1f7408208 Added price zones 2022-09-25 11:46:04 +02:00
Gunnar Skjold
feb8e5007b Fixed MQTT buffer size 2022-09-25 10:50:34 +02:00
Gunnar Skjold
c4af1ee74f Fixed saving tariff thresholds 2022-09-25 10:50:09 +02:00
Gunnar Skjold
992e1b6121 Net value for active power (L&G) 2022-09-12 08:03:32 +02:00
Gunnar Skjold
95d3008a66 Updates to Svelte UI 2022-09-12 07:29:25 +02:00
Gunnar Skjold
04cd6ac387 Some changes to make Svelte UI work 2022-09-03 14:37:31 +02:00
Gunnar Skjold
584c7b1154 More restructuring 2022-09-03 14:03:15 +02:00
Gunnar Skjold
493c4b4337 Moved Svelte UI to lib folder 2022-09-03 13:41:11 +02:00
Gunnar Skjold
488c969858 Some serious restructuring to be able to swap between implementations 2022-09-03 13:12:29 +02:00
Gunnar Skjold
8b0d4185d3 Created new UI with Svelte 2022-09-03 12:19:56 +02:00
Gunnar Skjold
9cc7529934 Fixed L&G scaling 2022-08-31 08:19:09 +02:00
Gunnar Skjold
ef8715be6d Merge branch 'master' into lng-parser 2022-08-31 08:04:24 +02:00
Gunnar Skjold
e232b875fa Fixed Aidon timestamp 2022-08-23 21:07:06 +02:00
Gunnar Skjold
f18171fecc Fixed MQTT byte mode 2022-08-23 20:39:47 +02:00
Gunnar Skjold
a3c7a09211 Adding peaks to data.json and MQTT RAW 2022-08-23 20:21:19 +02:00
Gunnar Skjold
a6f3bc3f71 Added version to system json 2022-08-23 19:49:19 +02:00
Gunnar Skjold
44bcd386d1 aggregate obis 1.8.x and 2.8.x for L&G 2022-08-23 09:04:45 +02:00
Gunnar Skjold
01547f9a52 Adjustments to make L&G parser work 2022-08-19 13:26:29 +02:00
Gunnar Skjold
608470c5f7 Merge branch 'master' into hub-prices 2022-08-18 19:56:31 +02:00
Gunnar Skjold
940d38af5c Merge branch 'master' into lng-parser 2022-08-17 17:33:24 +02:00
Gunnar Skjold
4e451c51e1 HW serial fix for S2 2022-08-17 17:33:06 +02:00
Gunnar Skjold
43def1c311 Fixed Pow-P1 profile 2022-08-17 17:32:53 +02:00
Gunnar Skjold
a055465ce0 Untestet L&G data parser 2022-08-16 08:22:43 +02:00
Gunnar Skjold
68b3415a6c Cleanup for price API 2022-08-13 16:32:55 +02:00
Gunnar Skjold
d8f3ae8b07 Merge branch 'master' into hub-prices 2022-08-13 16:00:25 +02:00
Gunnar Skjold
1a92cd1978 Fetch prices from hub 2022-08-12 20:41:53 +02:00
347 changed files with 36455 additions and 13526 deletions

View File

@@ -0,0 +1,31 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "amsreader-devcontainer",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/devcontainers/features/node:1": {
"version": "19",
"pnpmVersion": "none",
"nvmVersion": "latest"
},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.9"
}
},
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": ".devcontainer/postCreateCommand.sh",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"platformio.platformio-ide",
"ms-vscode.cpptools",
"svelte.svelte-vscode"
]
}
}
}

View File

@@ -0,0 +1,18 @@
#!/bin/bash
set -e
# Upgrade pip
python -m pip install --upgrade pip
# Install Python packages
pip install -U platformio css_html_js_minify
# Navigate to the Svelte app directory
cd lib/SvelteUi/app
# Install npm dependencies and build the app
npm ci
npm run build
# Return to the previous directory
cd -

3
.gitattributes vendored Normal file
View File

@@ -0,0 +1,3 @@
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf

2
.github/FUNDING.yml vendored
View File

@@ -1 +1 @@
custom: ["https://paypal.me/gskjold"]
custom: ["https://amsleser.no"]

View File

@@ -33,6 +33,7 @@ If applicable, add screenshots to help explain your problem.
**Relevant firmware information:**
- Version: [e.g. 2.1.0]
- MQTT: [yes/no]
- MQTT payload type: [e.g. JSON]
- HAN GPIO: [e.g. GPIO5]
- HAN baud and parity: [e.g. 2400 8E1]
- Temperature sensors [e.g. 3xDS18B20]

View File

@@ -1,8 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Meter configuration
url: https://github.com/gskjold/AmsToMqttBridge/wiki/Known-hardware-configurations
url: https://github.com/UtilitechAS/amsreader-firmware/wiki/Known-hardware-configurations
about: Please check your meter configuration here first.
- name: Frequently asked questions
url: https://github.com/gskjold/AmsToMqttBridge/wiki/FAQ
url: https://github.com/UtilitechAS/amsreader-firmware/wiki/FAQ
about: Please check frequently asked questions first.

View File

@@ -20,6 +20,7 @@ A clear and concise description of what the problem is.
**Relevant firmware information:**
- Version: [e.g. 2.1.0]
- MQTT: [yes/no]
- MQTT payload type: [e.g. JSON]
- HAN GPIO: [e.g. GPIO5]
- HAN baud and parity: [e.g. 2400 8E1]
- Temperature sensors [e.g. 3xDS18B20]

View File

@@ -8,6 +8,7 @@ on:
- scripts/**
- web/**
- platformio.ini
- .github/workflows/**
branches:
- '*'
tags:
@@ -21,26 +22,45 @@ jobs:
steps:
- name: Check out code from repo
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Inject secrets into ini file
run: |
sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini
sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini
sed -i 's/NO_AMS2MQTT_SC_KEY/AMS2MQTT_SC_KEY=\\"${{secrets.AMS2MQTT_SC_KEY}}\\"/g' platformio.ini
sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\\"${{secrets.ENERGY_SPEEDOMETER_USER}}\\"/g' platformio.ini
sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\\"/g' platformio.ini
- name: Cache Python dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('platformio.ini') }}
- name: Cache PlatformIO dependencies
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.pio/libdeps
key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini') }}
- name: Set up Python 3.9
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio css_html_js_minify
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: '19.x'
- name: Build with node
run: |
cd lib/SvelteUi/app
npm ci
npm run build
cd -
env:
CI: true
- name: PlatformIO lib install
run: pio lib install
run: pio pkg install
- name: PlatformIO run
run: pio run

41
.github/workflows/localazy.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Deploy language files from localazy
on:
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out code from repo
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-north-1
- name: Generate localazy-keys.json
run: |
echo '{"writeKey": "", "readKey": "${{secrets.LOCALAZY_READ_KEY}}"}' > localazy/localazy-keys.json
- name: Create localazy language folder
run: mkdir -p localazy/language
- name: Install Localazy CLI
run: npm install -g @localazy/cli
- name: Download translations
working-directory: localazy
run: localazy download -k localazy-keys.json
- name: Upload translations to S3
run: aws s3 sync ./localazy/language/ s3://${{ secrets.AWS_S3_BUCKET }}/language/

85
.github/workflows/prerelease.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: Release candidate build and upload
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Check out code from repo
uses: actions/checkout@v4
- name: Get release version for filenames
id: release_tag
env:
GITHUB_REF: ${{ github.ref }}
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:11})
- name: Create release with release notes
id: create_release
uses: ncipollo/release-action@v1
with:
name: Release candidate v${{ steps.release_tag.outputs.tag }}
prerelease: true
outputs:
version: ${{ steps.release_tag.outputs.tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
esp32s2:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32s2
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
esp32s3:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32s3
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
esp32c3:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32c3
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
esp32:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
esp32solo:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32solo
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
esp8266:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp8266
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
subfolder: /rc
is_esp32: false

136
.github/workflows/release-deploy-env.yml vendored Normal file
View File

@@ -0,0 +1,136 @@
name: Build with env and deploy
on:
workflow_call:
inputs:
env:
description: 'The environment to build for'
required: true
type: string
upload_url:
description: 'The upload URL for the release assets'
required: true
type: string
version:
description: 'The version tag for the release assets'
required: true
type: string
subfolder:
description: 'The subfolder in S3 to upload the binary to'
required: false
type: string
default: ''
is_esp32:
description: 'Whether the build is for ESP32 based firmware'
required: false
type: boolean
default: true
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Check out code from repo
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-north-1
- name: Cache Python dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('platformio.ini') }}
- name: Cache PlatformIO dependencies
uses: actions/cache@v4
with:
path: ~/.pio/libdeps
key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini') }}
- name: Set up Python 3.9
uses: actions/setup-python@v5
with:
python-version: 3.9
- name: Inject secrets into ini file
run: |
sed -i 's/NO_AMS2MQTT_PRICE_KEY/AMS2MQTT_PRICE_KEY="${{secrets.AMS2MQTT_PRICE_KEY}}"/g' platformio.ini
sed -i 's/NO_AMS2MQTT_PRICE_AUTHENTICATION/AMS2MQTT_PRICE_AUTHENTICATION="${{secrets.AMS2MQTT_PRICE_AUTHENTICATION}}"/g' platformio.ini
sed -i 's/NO_AMS2MQTT_SC_KEY/AMS2MQTT_SC_KEY=\\"${{secrets.AMS2MQTT_SC_KEY}}\\"/g' platformio.ini
sed -i 's/NO_ENERGY_SPEEDOMETER_USER/ENERGY_SPEEDOMETER_USER=\\"${{secrets.ENERGY_SPEEDOMETER_USER}}\\"/g' platformio.ini
sed -i 's/NO_ENERGY_SPEEDOMETER_PASS/ENERGY_SPEEDOMETER_PASS=\\"${{secrets.ENERGY_SPEEDOMETER_PASS}}\\"/g' platformio.ini
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio css_html_js_minify
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: '19.x'
- name: Build with node
run: |
cd lib/SvelteUi/app
npm ci
npm run build
cd -
env:
CI: false
- name: PlatformIO lib install
run: pio lib install
- name: Build firmware
env:
GITHUB_TAG: v${{ inputs.version }}
run: pio run -e ${{ inputs.env }}
- name: Create zip file
run: /bin/sh scripts/${{ inputs.env }}/mkzip.sh
- name: Upload binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: .pio/build/${{ inputs.env }}/firmware.bin
asset_name: ams2mqtt-${{ inputs.env }}-${{ inputs.version }}.bin
asset_content_type: application/octet-stream
- name: Upload zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: ${{ inputs.env }}.zip
asset_name: ams2mqtt-${{ inputs.env }}-${{ inputs.version }}.zip
asset_content_type: application/zip
- name: Create MD5 checksum file
run: md5sum .pio/build/${{ inputs.env }}/firmware.bin | cut -z -d ' ' -f 1 > firmware.md5
- name: Upload binary to S3
run: aws s3 cp .pio/build/${{ inputs.env }}/firmware.bin s3://${{ secrets.AWS_S3_BUCKET }}/firmware${{ inputs.subfolder }}/ams2mqtt-${{ inputs.env }}-${{ inputs.version }}.bin
- name: Upload MD5 checksum to S3
run: aws s3 cp firmware.md5 s3://${{ secrets.AWS_S3_BUCKET }}/firmware${{ inputs.subfolder }}/ams2mqtt-${{ inputs.env }}-${{ inputs.version }}.md5
- name: Upload bootloader to S3
if: ${{ inputs.is_esp32 }}
run: aws s3 cp .pio/build/${{ inputs.env }}/bootloader.bin s3://${{ secrets.AWS_S3_BUCKET }}/firmware${{ inputs.subfolder }}/ams2mqtt-${{ inputs.env }}-${{ inputs.version }}-bootloader.bin
- name: Upload partition table to S3
if: ${{ inputs.is_esp32 }}
run: aws s3 cp .pio/build/${{ inputs.env }}/partitions.bin s3://${{ secrets.AWS_S3_BUCKET }}/firmware${{ inputs.subfolder }}/ams2mqtt-${{ inputs.env }}-${{ inputs.version }}-partitions.bin
- name: Upload app0 to S3
if: ${{ inputs.is_esp32 }}
run: aws s3 cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin s3://${{ secrets.AWS_S3_BUCKET }}/firmware${{ inputs.subfolder }}/ams2mqtt-${{ inputs.env }}-${{ inputs.version }}-app0.bin

View File

@@ -1,124 +1,79 @@
name: Release
name: Release build and upload
on:
push:
tags:
- 'v*.*.*'
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
build:
prepare:
runs-on: ubuntu-latest
steps:
- name: Check out code from repo
uses: actions/checkout@v1
- name: Get release version for filenames
id: release_tag
env:
GITHUB_REF: ${{ github.ref }}
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:11})
- name: Get release version for code
env:
GITHUB_REF: ${{ github.ref }}
run: echo "GITHUB_TAG=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
- name: Cache Python dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('platformio.ini') }}
- name: Cache PlatformIO dependencies
uses: actions/cache@v1
with:
path: ~/.pio/libdeps
key: ${{ runner.os }}-pio-${{ hashFiles('platformio.ini') }}
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio css_html_js_minify
- name: PlatformIO lib install
run: pio lib install
- name: PlatformIO run
run: pio run
- name: Create zip files
run: /bin/sh scripts/mkzip.sh
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Check out code from repo
uses: actions/checkout@v4
- name: Get release version for filenames
id: release_tag
env:
GITHUB_REF: ${{ github.ref }}
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:11})
- name: Upload esp8266 zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: esp8266.zip
asset_name: ams2mqtt-esp8266-${{ steps.release_tag.outputs.tag }}.zip
asset_content_type: application/zip
- name: Upload esp32 zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: esp32.zip
asset_name: ams2mqtt-esp32-${{ steps.release_tag.outputs.tag }}.zip
asset_content_type: application/zip
- name: Upload esp32s2 zip to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: esp32s2.zip
asset_name: ams2mqtt-esp32s2-${{ steps.release_tag.outputs.tag }}.zip
asset_content_type: application/zip
- name: Create release with release notes
id: create_release
uses: ncipollo/release-action@v1
with:
name: Release v${{ steps.release_tag.outputs.tag }}
generateReleaseNotes: true
- name: Upload esp8266 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/esp8266/firmware.bin
asset_name: ams2mqtt-esp8266-${{ steps.release_tag.outputs.tag }}.bin
asset_content_type: application/octet-stream
- name: Upload esp32 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/esp32/firmware.bin
asset_name: ams2mqtt-esp32-${{ steps.release_tag.outputs.tag }}.bin
asset_content_type: application/octet-stream
- name: Upload esp32solo binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/esp32solo/firmware.bin
asset_name: ams2mqtt-esp32solo-${{ steps.release_tag.outputs.tag }}.bin
asset_content_type: application/octet-stream
- name: Upload esp32s2 binary to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: .pio/build/esp32s2/firmware.bin
asset_name: ams2mqtt-esp32s2-${{ steps.release_tag.outputs.tag }}.bin
asset_content_type: application/octet-stream
outputs:
version: ${{ steps.release_tag.outputs.tag }}
upload_url: ${{ steps.create_release.outputs.upload_url }}
esp32s2:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32s2
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
esp32s3:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32s3
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
esp32c3:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32c3
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
esp32:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
esp32solo:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp32solo
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
esp8266:
needs: prepare
uses: ./.github/workflows/release-deploy-env.yml
secrets: inherit
with:
env: esp8266
version: ${{ needs.prepare.outputs.version }}
upload_url: ${{ needs.prepare.outputs.upload_url }}
is_esp32: false

8
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.vs/
.idea/
[Dd]ebug/
[Rr]elease/
**/__vm/
@@ -7,7 +8,7 @@
.vscode
.pio
platformio-user.ini
/src/version.h
/lib/FirmwareVersion/src/generated_version.h
/src/web/root
/src/AmsToMqttBridge.ino.cpp
/test
@@ -15,3 +16,8 @@ platformio-user.ini
/sdkconfig
/.tmp
/*.zip
node_modules
/gui/dist
/scripts/*dev
localazy-keys.json
localazy/language

643
LICENSE
View File

@@ -1,617 +1,44 @@
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Fair Source License, version 0.9
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Copyright (C) 2023 Utilitech AS
Preamble
Licensor: Utilitech AS
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
Software: AMS reader
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
Use Limitation: 5 users
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
License Grant. Licensor hereby grants to each recipient of the
Software ("you") a non-exclusive, non-transferable, royalty-free and
fully-paid-up license, under all of the Licensor's copyright and
patent rights, to use, copy, distribute, prepare derivative works of,
publicly perform and display the Software, subject to the Use
Limitation and the conditions set forth below.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
Use Limitation. The license granted above allows use by up to the
number of users per entity set forth above (the "Use Limitation"). For
determining the number of users, "you" includes all affiliates,
meaning legal entities controlling, controlled by, or under common
control with you. If you exceed the Use Limitation, your use is
subject to payment of Licensor's then-current list price for licenses.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
Conditions. Redistribution in source code or other forms must include
a copy of this license document to be provided in a reasonable
manner. Any redistribution of the Software is only allowed subject to
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
Trademarks. This license does not grant you any right in the
trademarks, service marks, brand names or logos of Licensor.
DISCLAIMER. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OR
CONDITION, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. LICENSORS HEREBY DISCLAIM ALL LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE.
Termination. If you violate the terms of this license, your rights
will terminate automatically and will not be reinstated without the
prior written consent of Licensor. Any such termination will not
affect the right of others who may have received copies of the
Software from you.

View File

@@ -1,12 +1,15 @@
# AMS MQTT Bridge
# AMS Reader
This code is designed to decode data from electric smart meters installed in many countries in Europe these days. The data is presented in a graphical web interface and can also send the data to a MQTT broker which makes it suitable for home automation project. Originally it was only designed to work with Norwegian meters, but has since been adapter to read any IEC-62056-7-5 or IEC-62056-21 compliant meters.
Later development have added Energy usage graph for both day and month, as well as future energy price (Prices only available for ESP32). The code can run on any ESP8266 or ESP32 hardware which you can read more about in the [WiKi](https://github.com/gskjold/AmsToMqttBridge/wiki). If you don't have the knowledge to set up a ESP device yourself, have a look at the shop at [amsleser.no](https://amsleser.no/).
Later development have added Energy usage graph for both day and month, as well as future energy price. The code can run on any ESP8266 or ESP32 hardware which you can read more about in the [WiKi](https://github.com/UtilitechAS/amsreader-firmware/wiki). If you don't have the knowledge to set up a ESP device yourself, or you would like to support our work, please have a look at our shop at [amsleser.no](https://www.amsleser.no/).
<img src="webui.png">
<img src="images/dashboard.png">
Go to the [WiKi](https://github.com/gskjold/AmsToMqttBridge/wiki) for information on how to get your own device! And find the latest prebuilt firmware file at the [release section](https://github.com/gskjold/AmsToMqttBridge/releases).
## Installing pre-built firmware
If you have a device already running this firmware and you for some reason need to upgrade via USB port, you can use a [this web-based tool](https://www.amsleser.cloud/flasher)
If you are using a development board and want to flash a pre-built firmware manually, get the necessary files from the [release](https://github.com/UtilitechAS/amsreader-firmware/releases) section and visit the [WiKi](https://github.com/UtilitechAS/amsreader-firmware/wiki) and have a look at the [Flashing](https://github.com/UtilitechAS/amsreader-firmware/wiki/flashinghttps://github.com/UtilitechAS/amsreader-firmware/wiki/flashing) section
## Building this project with PlatformIO
To build this project, you need [PlatformIO](https://platformio.org/) installed.
@@ -18,3 +21,12 @@ It is recommended to use Visual Studio Code with the PlatformIO plugin for devel
[PlatformIO vscode plugin](https://platformio.org/install/ide?install=vscode)
For development purposes, copy the ```platformio-user.ini-example``` to ```platformio-user.ini``` and customize to your preference. The code will adapt to the platform and board set in your profile.
## Licensing
Initially, this project began as a hobby, consuming countless hours of our spare time. However, the time required to support this project has expanded beyond the scope of a hobby. As a result, we established Utilitech, a company dedicated to maintaining the software and hardware for this project as part of our regular work.
To ensure the sustainability of our venture, we have opted to license our software under the [Fair Source License] (https://fair.io). This approach allows the software to remain free for personal use, while also ensuring full transparency of our codes inner workings. It also prevents competitors from exploiting our work without contributing to the maintenance of the code or providing technical support to end users.
For more information, please refer to our [LICENSE](/LICENSE) file.
If your usage falls outside the scope of this license and you require a separate license, please contact us at [post@utilitech.no](mailto:post@utilitech.no) for further details.

7
custom_partition.csv Normal file
View File

@@ -0,0 +1,7 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x1D0000,
app1, app, ota_1, 0x1E0000,0x1D0000,
spiffs, data, spiffs, 0x3B0000,0x40000,
coredump, data, coredump,0x3F0000,0x10000,
1 # Name Type SubType Offset Size Flags
2 nvs data nvs 0x9000 0x5000
3 otadata data ota 0xe000 0x2000
4 app0 app ota_0 0x10000 0x1D0000
5 app1 app ota_1 0x1E0000 0x1D0000
6 spiffs data spiffs 0x3B0000 0x40000
7 coredump data coredump 0x3F0000 0x10000

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@

View File

@@ -31,3 +31,59 @@ Object with three values Value Object with two values
02 03 09 06 01 00 04 08 00 FF 06 00 0A F5 EC 02 02 0F 01 16 20
51 D7
7E
Received 21.09.24 20:00:10:
(V) 7E A1 8A 41 08 83 13 EB FD E6 E7 00 0F 40 00 00
(V) 00 00 01 12 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 41 49 44 4F 4E 5F 56 30 30 30 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 37 33 35 39 39 39 32 38 39
(V) 30 34 39 37 39 39 37 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 36 35 33 34 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 02 71 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 00
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 01 F0 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 00 06 02 02 0F FF 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 05 02 02 0F FF 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 00 17 02 02
(V) 0F FF 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 3F 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 09 36 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 22 02 02 0F FF 16 23 02 02 09
(V) 06 00 00 01 00 00 FF 09 0C 07 E8 09 15 06 13 00
(V) 00 FF 00 00 00 02 03 09 06 01 00 01 08 00 FF 06
(V) 00 8D 98 13 02 02 0F 01 16 1E 02 03 09 06 01 00
(V) 02 08 00 FF 06 00 00 00 00 02 02 0F 01 16 1E 02
(V) 03 09 06 01 00 03 08 00 FF 06 00 00 29 6E 02 02
(V) 0F 01 16 20 02 03 09 06 01 00 04 08 00 FF 06 00
(V) 13 F2 06 02 02 0F 01 16 20 C8 1D 7E
Received 27.10.24 11:00:13:
(V) 7E A1 8A 41 08 83 13 EB FD E6 E7 00 0F 40 00 00
(V) 00 00 01 12 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 41 49 44 4F 4E 5F 56 30 30 30 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 37 33 35 39 39 39 32 38 39
(V) 30 34 39 37 39 39 37 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 36 35 33 34 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 02 AA 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 00
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 01 CC 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 00 02 02 02 0F FF 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 0B 02 02 0F FF 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 00 16 02 02
(V) 0F FF 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 2F 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 09 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 0F 02 02 0F FF 16 23 02 02 09
(V) 06 00 00 01 00 00 FF 09 0C 07 E8 0A 1B 00 0B 00
(V) 00 FF 00 00 00 02 03 09 06 01 00 01 08 00 FF 06
(V) 00 8F 25 6F 02 02 0F 01 16 1E 02 03 09 06 01 00
(V) 02 08 00 FF 06 00 00 00 00 02 02 0F 01 16 1E 02
(V) 03 09 06 01 00 03 08 00 FF 06 00 00 29 8D 02 02
(V) 0F 01 16 20 02 03 09 06 01 00 04 08 00 FF 06 00
(V) 14 44 26 02 02 0F 01 16 20 84 09 7E

14
frames/EGM5G35.txt Normal file
View File

@@ -0,0 +1,14 @@
2F 45 47 4D 35 47 33 35 // DSMR Identifier
0D 0A // CRLF
0D 0A // CRLF
00 // System title, blank
82 // Two-byte length follows
02 30 // 560 bytes
30 // Security tag 0011 0000, 0=Compression off, 0=Unicast, 1=Encryption, 1=Authentication, 0000= Security Suite ID
00 00 00 00 // Frame counter, blank
// Encrypted payload follows (560 - security tag - frame counter = 555 bytes)
30 10 73 D6 59 85 96 B0 2A 8B CC E7 33 AD 19 A3 A5 4A 4D 0E 3A CE F6 33 DB 57 0A 45 9A C3 5B F0 D4 C0 AA 15 B9 93 B0 E8 67 85 EC 22 CA 40 8C D7 1A B5 62 AE DF 0F 48 EA D9 E6 56 FB 84 B3 7B 47 C6 29 12 F1 EE BB 22 88 26 75 5C F8 A2 20 F4 93 F3 64 CA 7C C6 60 32 62 B0 7F F9 7F 71 0A 9F DF AB 61 89 6A 9A 10 B1 DF 94 2C 74 8F 51 B6 09 5C F2 45 6C 38 54 52 FE B6 CB 1F 42 F2 93 DC 57 BE EE 5A 0D F8 1F 53 55 0E 21 EF 46 0A 72 74 CA AB D8 9C A9 05 9E FD 54 5E CC 7B 71 40 E1 22 B2 25 5C D5 63 80 BD 97 6E 54 4B 24 A6 58 1F 79 1F 45 C7 DF C0 83 3B 7F 1E C7 43 B9 26 F6 EB 6E F2 B1 7C 99 3A 91 EA 39 72 E5 FB 72 B1 E1 24 AF 9D 19 8A 6C 50 69 97 90 D3 3D 68 97 57 C2 EC 49 EF 12 1D 11 44 46 70 46 88 88 98 37 6F B0 93 FC D2 3F 37 66 1C C7 F0 93 E3 AF 4D 3C BE 41 8E B9 48 77 A9 92 5B 42 0A 96 E5 34 4D 30 56 90 5A 08 03 CC 41 78 58 79 FD 89 82 E0 46 3D 66 AA 42 85 F4 A8 46 2D 4A E4 81 12 40 68 D6 F5 F9 11 5A 94 51 21 3C 9F 4F F7 FE B3 B5 BF 1E D2 12 CF B9 FB 28 D0 B4 82 9E 11 D8 1C FC E3 36 EC DE 8A 7C 83 76 F7 EB 3D 2C 4A B7 7F 75 91 F1 F5 18 D4 70 6A C9 3E 3D 3F 9E 0F C6 0F A7 E7 20 11 03 E7 75 4E 40 F1 5E BA 86 30 6D C0 28 C4 14 47 DF 6A EF CC FE E4 B6 23 58 2B 9D 4F BF 6A A8 93 84 F4 CD 4D FF 47 B5 C4 81 D2 DA D3 6B C3 F4 1D C4 6E E1 9B 24 30 91 7B 33 57 67 B6 E4 93 FE 8B 5B AE 8A 0D 81 DE A5 C3 3F 82 9A CE E2 BA 6D 50 39 FC 99 E6 7A 7B B4 E9 A9 84 78 AF 2D 4C D2 15 53 6B 98 2B 1F C8 3D 57 9E 49 68 40 0C D3 4A 9E D6 4F 1F 12 50 84 32 AD 62 C6 D3 42 34 46 66 65 56 49 81 F4 BC 8E C6 75 77 11 1F 29 BB 80 20 23 0A 80 D5 31 50 16 89 6F 07 4A 25 BE F0 4B 60 36 87 AE A6 2A 53 79 22 15 A5 2A C7 1D 15 7B 87 DD B5 07 3D 1C 28 C1 B6 51 47 2F 39 DE D9 B9 29 B6 78
21 // End of DSMR (!)
46 45 30 43 // FE0C - Checksum
0D 0A // CRLF

View File

@@ -31,4 +31,183 @@ C9 95 7E // CRC and end tag
06 00 00 00 00 06 00 00 00 00 06 00 00 01 67 06 00 00 03 BF 06 00 00 05 05
06 00 00 24 34 06 00 00 09 45 06 00 00 09 4F 06 00 00 09 3B
09 0C 07 E5 03 17 02 13 00 0A FF 80 00 00 06 01 34 3B 5D 06 00 00 00 00 06 00 00 09 36 06 00 3C 7A 98 DA 15 7E
7E A0 79 01 02 01 10 80 93 E6 E7 00 0F 40 00 00 00 09 0C 07 E1 09 0E 04 15 1F 14 FF 80 00 00 02 0D 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37 30 36 33 31 34 30 31 37 35 33 39 38 35 09 08 4D 41 33 30 34 48 33 45 06 00 00 04 0C 06 00 00 00 00 06 00 00 00 00 06 00 00 00 4E 06 00 00 07 C1 06 00 00 0C 9E 06 00 00 0D 7E 06 00 00 09 5F 06 00 00 00 00 06 00 00 09 66 87 96 7E
7E A0 79 01 02 01 10 80 93 E6 E7 00 0F 40 00 00 00 09 0C 07 E1 09 0E 04 15 1F 14 FF 80 00 00 02 0D 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37 30 36 33 31 34 30 31 37 35 33 39 38 35 09 08 4D 41 33 30 34 48 33 45 06 00 00 04 0C 06 00 00 00 00 06 00 00 00 00 06 00 00 00 4E 06 00 00 07 C1 06 00 00 0C 9E 06 00 00 0D 7E 06 00 00 09 5F 06 00 00 00 00 06 00 00 09 66 87 96 7E
01.10.24 19:00 ish:
(D) READY to update (internal clock 16:59:58 UTC, meter clock: 00:00:00, list type 1, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 78 01 02 01 10 C4 98 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 00 FF 80 00 00 02
(V) 0D 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37 30
(V) 36 33 31 34 30 37 32 36 32 39 38 36 09 07 4D 41
(V) 33 30 34 48 34 06 00 00 13 C0 06 00 00 00 00 06
(V) 00 00 00 00 06 00 00 01 D5 06 00 00 4C DF 06 00
(V) 00 05 0C 06 00 00 03 9B 06 00 00 09 34 06 00 00
(V) 09 69 06 00 00 09 59 18 EB 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 00 FF 80 00 00 02 0D 09 07 4B 46 4D 5F 30 30
(V) 31 09 10 36 39 37 30 36 33 31 34 30 37 32 36 32
(V) 39 38 36 09 07 4D 41 33 30 34 48 34 06 00 00 13
(V) C0 06 00 00 00 00 06 00 00 00 00 06 00 00 01 D5
(V) 06 00 00 4C DF 06 00 00 05 0C 06 00 00 03 9B 06
(V) 00 00 09 34 06 00 00 09 69 06 00 00 09 59
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 00 FF
(V) 80 00 00 02 0D 09 07 4B 46 4D 5F 30 30 31 09 10
(V) 36 39 37 30 36 33 31 34 30 37 32 36 32 39 38 36
(V) 09 07 4D 41 33 30 34 48 34 06 00 00 13 C0 06 00
(V) 00 00 00 06 00 00 00 00 06 00 00 01 D5 06 00 00
(V) 4C DF 06 00 00 05 0C 06 00 00 03 9B 06 00 00 09
(V) 34 06 00 00 09 69 06 00 00 09 59
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 0D 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37
(V) 30 36 33 31 34 30 37 32 36 32 39 38 36 09 07 4D
(V) 41 33 30 34 48 34 06 00 00 13 C0 06 00 00 00 00
(V) 06 00 00 00 00 06 00 00 01 D5 06 00 00 4C DF 06
(V) 00 00 05 0C 06 00 00 03 9B 06 00 00 09 34 06 00
(V) 00 09 69 06 00 00 09 59
(V) DLMS
(D) READY to update (internal clock 17:00:01 UTC, meter clock: 00:00:00, list type 2, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 02 FF 80 00 00 02
(V) 01 06 00 00 13 C1 56 F5 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 02 FF 80 00 00 02 01 06 00 00 13 C1
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 02 FF
(V) 80 00 00 02 01 06 00 00 13 C1
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 C1
(V) DLMS
(D) READY to update (internal clock 17:00:02 UTC, meter clock: 00:00:00, list type 1, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 04 FF 80 00 00 02
(V) 01 06 00 00 13 BC F9 5A 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 04 FF 80 00 00 02 01 06 00 00 13 BC
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 04 FF
(V) 80 00 00 02 01 06 00 00 13 BC
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 BC
(V) DLMS
(D) READY to update (internal clock 17:00:04 UTC, meter clock: 00:00:00, list type 1, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 06 FF 80 00 00 02
(V) 01 06 00 00 13 BC 42 58 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 06 FF 80 00 00 02 01 06 00 00 13 BC
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 06 FF
(V) 80 00 00 02 01 06 00 00 13 BC
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 BC
(V) DLMS
(D) READY to update (internal clock 17:00:06 UTC, meter clock: 00:00:00, list type 1, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 08 FF 80 00 00 02
(V) 01 06 00 00 13 BB DC 21 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 08 FF 80 00 00 02 01 06 00 00 13 BB
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 08 FF
(V) 80 00 00 02 01 06 00 00 13 BB
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 BB
(V) DLMS
(D) READY to update (internal clock 17:00:08 UTC, meter clock: 00:00:00, list type 1, est: 1, using clock: 1)
(V) HDLC frame:
(V) 7E A0 9A 01 02 01 10 AA A5 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 0A FF 80 00 00 02
(V) 12 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37 30
(V) 36 33 31 34 30 37 32 36 32 39 38 36 09 07 4D 41
(V) 33 30 34 48 34 06 00 00 13 C0 06 00 00 00 00 06
(V) 00 00 00 00 06 00 00 01 D5 06 00 00 4C DD 06 00
(V) 00 05 0E 06 00 00 03 90 06 00 00 09 34 06 00 00
(V) 09 69 06 00 00 09 59 09 0C 07 E8 0A 01 02 13 00
(V) 0A FF 80 00 00 06 02 8E 4B 5E 06 00 00 00 00 06
(V) 00 97 35 DE 06 00 08 97 2F FA E5 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 0A FF 80 00 00 02 12 09 07 4B 46 4D 5F 30 30
(V) 31 09 10 36 39 37 30 36 33 31 34 30 37 32 36 32
(V) 39 38 36 09 07 4D 41 33 30 34 48 34 06 00 00 13
(V) C0 06 00 00 00 00 06 00 00 00 00 06 00 00 01 D5
(V) 06 00 00 4C DD 06 00 00 05 0E 06 00 00 03 90 06
(V) 00 00 09 34 06 00 00 09 69 06 00 00 09 59 09 0C
(V) 07 E8 0A 01 02 13 00 0A FF 80 00 00 06 02 8E 4B
(V) 5E 06 00 00 00 00 06 00 97 35 DE 06 00 08 97 2F
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 0A FF
(V) 80 00 00 02 12 09 07 4B 46 4D 5F 30 30 31 09 10
(V) 36 39 37 30 36 33 31 34 30 37 32 36 32 39 38 36
(V) 09 07 4D 41 33 30 34 48 34 06 00 00 13 C0 06 00
(V) 00 00 00 06 00 00 00 00 06 00 00 01 D5 06 00 00
(V) 4C DD 06 00 00 05 0E 06 00 00 03 90 06 00 00 09
(V) 34 06 00 00 09 69 06 00 00 09 59 09 0C 07 E8 0A
(V) 01 02 13 00 0A FF 80 00 00 06 02 8E 4B 5E 06 00
(V) 00 00 00 06 00 97 35 DE 06 00 08 97 2F
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 12 09 07 4B 46 4D 5F 30 30 31 09 10 36 39 37
(V) 30 36 33 31 34 30 37 32 36 32 39 38 36 09 07 4D
(V) 41 33 30 34 48 34 06 00 00 13 C0 06 00 00 00 00
(V) 06 00 00 00 00 06 00 00 01 D5 06 00 00 4C DD 06
(V) 00 00 05 0E 06 00 00 03 90 06 00 00 09 34 06 00
(V) 00 09 69 06 00 00 09 59 09 0C 07 E8 0A 01 02 13
(V) 00 0A FF 80 00 00 06 02 8E 4B 5E 06 00 00 00 00
(V) 06 00 97 35 DE 06 00 08 97 2F
(V) DLMS
(D) READY to update (internal clock 17:00:12 UTC, meter clock: 17:00:10, list type 3, est: 1, using clock: 0)
(D) Updating data storage using actual data
(D) Clearing hours from 16 to 17
(D) Clearing days from 1 to 1
(D) Day is not happy
(D) - normal
(I) Saving data
(I) Saving energy accounting
(W) Used 1249ms to read HAN port (true)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 0C FF 80 00 00 02
(V) 01 06 00 00 13 BC 15 50 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 0C FF 80 00 00 02 01 06 00 00 13 BC
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 0C FF
(V) 80 00 00 02 01 06 00 00 13 BC
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 BC
(V) DLMS
(D) NOT Ready to update (internal clock 17:00:12 UTC, meter clock: 00:00:00, list type 1, est: 0)
(V) HDLC frame:
(V) 7E A0 27 01 02 01 10 5A 87 E6 E7 00 0F 40 00 00
(V) 00 09 0C 07 E8 0A 01 02 13 00 0E FF 80 00 00 02
(V) 01 06 00 00 13 B7 7D EC 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13
(V) 00 0E FF 80 00 00 02 01 06 00 00 13 B7
(V) DLMS frame:
(V) 0F 40 00 00 00 09 0C 07 E8 0A 01 02 13 00 0E FF
(V) 80 00 00 02 01 06 00 00 13 B7
(D) Received valid DLMS at 31
(V) Using application data:
(V) 02 01 06 00 00 13 B7

File diff suppressed because it is too large Load Diff

682
frames/L&G-E350_Norway.raw Normal file
View File

@@ -0,0 +1,682 @@
*** Remote debug - over telnet - for ESP32 - version 3.0.5
* Host name: ams-e603 IP:10.10.10.62 Mac address:D8:3B:DA:C4:03:E6
* Free Heap RAM: 87952
* ESP SDK version: 4.4.5.230722
******************************************************
* Commands:
? or help -> display these help of commands
q -> quit (close this connection)
m -> display memory available
v -> set debug level to verbose
d -> set debug level to debug
i -> set debug level to info
w -> set debug level to warning
e -> set debug level to errors
s -> set debug silence on/off
l -> show debug level
t -> show time (millis)
profiler:
p -> show time between actual and last message (in millis)
p min -> show only if time is this minimal
P time -> set debug level to profiler
c -> show colors
filter:
filter <string> -> show only debugs with this
nofilter -> disable the filter
* Please type the command and press enter to execute.(? or h for this help)
***
(V) HDLC frame:
(V) 7E A1 1E 41 08 83 13 EE EE E6 E7 00 0F 40 00 00
(V) 00 00 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 45 4D 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00
(V) 00 00 00 00 00 00 00 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 5A 46 46 31 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 24 F4 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 31
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 0C 6C 02 02 0F FE 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 0D 68 02 02
(V) 0F FE 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 2E 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 00 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 10 02 02 0F FF 16 23 2F AF 7E
(V)
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 0D 02 02 09 06 01
(V) 01 00 02 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31
(V) 5F 31 02 02 09 06 00 00 60 01 00 FF 0A 10 31 33
(V) 39 34 33 35 39 37 00 00 00 00 00 00 00 00 02 02
(V) 09 06 00 00 60 01 07 FF 0A 04 5A 46 46 31 02 03
(V) 09 06 01 00 01 07 00 FF 06 00 00 24 F4 02 02 0F
(V) 00 16 1B 02 03 09 06 01 00 02 07 00 FF 06 00 00
(V) 00 00 02 02 0F 00 16 1B 02 03 09 06 01 00 03 07
(V) 00 FF 06 00 00 00 31 02 02 0F 00 16 1D 02 03 09
(V) 06 01 00 04 07 00 FF 06 00 00 00 00 02 02 0F 00
(V) 16 1D 02 03 09 06 01 00 1F 07 00 FF 10 0C 6C 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 33 07 00 FF 10
(V) 00 00 02 02 0F FE 16 21 02 03 09 06 01 00 47 07
(V) 00 FF 10 0D 68 02 02 0F FE 16 21 02 03 09 06 01
(V) 00 20 07 00 FF 12 09 2E 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 34 07 00 FF 12 00 00 02 02 0F FF 16
(V) 23 02 03 09 06 01 00 48 07 00 FF 12 09 10 02 02
(V) 0F FF 16 23
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 0D 02 02 09 06 01 01 00 02
(V) 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31 5F 31 02
(V) 02 09 06 00 00 60 01 00 FF 0A 10 31 33 39 34 33
(V) 35 39 37 00 00 00 00 00 00 00 00 02 02 09 06 00
(V) 00 60 01 07 FF 0A 04 5A 46 46 31 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 F4 02 02 0F 00 16 1B
(V) 02 03 09 06 01 00 02 07 00 FF 06 00 00 00 00 02
(V) 02 0F 00 16 1B 02 03 09 06 01 00 03 07 00 FF 06
(V) 00 00 00 31 02 02 0F 00 16 1D 02 03 09 06 01 00
(V) 04 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1D 02
(V) 03 09 06 01 00 1F 07 00 FF 10 0C 6C 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 33 07 00 FF 10 00 00 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 47 07 00 FF 10
(V) 0D 68 02 02 0F FE 16 21 02 03 09 06 01 00 20 07
(V) 00 FF 12 09 2E 02 02 0F FF 16 23 02 03 09 06 01
(V) 00 34 07 00 FF 12 00 00 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 48 07 00 FF 12 09 10 02 02 0F FF 16
(V) 23
(D) Received valid DLMS at 18 +267
(V) Using application data:
(V) 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B 45 4D
(V) 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00 00 60
(V) 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00 00 00
(V) 00 00 00 00 00 02 02 09 06 00 00 60 01 07 FF 0A
(V) 04 5A 46 46 31 02 03 09 06 01 00 01 07 00 FF 06
(V) 00 00 24 F4 02 02 0F 00 16 1B 02 03 09 06 01 00
(V) 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1B 02
(V) 03 09 06 01 00 03 07 00 FF 06 00 00 00 31 02 02
(V) 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF 06 00
(V) 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01 00 1F
(V) 07 00 FF 10 0C 6C 02 02 0F FE 16 21 02 03 09 06
(V) 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16 21 02
(V) 03 09 06 01 00 47 07 00 FF 10 0D 68 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 20 07 00 FF 12 09 2E 02
(V) 02 0F FF 16 23 02 03 09 06 01 00 34 07 00 FF 12
(V) 00 00 02 02 0F FF 16 23 02 03 09 06 01 00 48 07
(V) 00 FF 12 09 10 02 02 0F FF 16 23
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:06 UTC, meter clock: 00:00:00, list type 2, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 F4 02 02 0F 00 16 1B A7 7F 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 F4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 F4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) F4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:07 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 F4 02 02 0F 00 16 1B A7 7F 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 F4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 F4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) F4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:10 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 E0 02 02 0F 00 16 1B 18 A5 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 E0 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 E0 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) E0 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:12 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A1 1E 41 08 83 13 EE EE E6 E7 00 0F 40 00 00
(V) 00 00 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 45 4D 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00
(V) 00 00 00 00 00 00 00 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 00 00 00 00 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 24 E0 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 28
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 0C 68 02 02 0F FE 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 0D 5D 02 02
(V) 0F FE 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 2E 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 00 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 10 02 02 0F FF 16 23 AE 9D 7E
(V)
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 0D 02 02 09 06 01
(V) 01 00 02 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31
(V) 5F 31 02 02 09 06 00 00 60 01 00 FF 0A 10 31 33
(V) 39 34 33 35 39 37 00 00 00 00 00 00 00 00 02 02
(V) 09 06 00 00 60 01 07 FF 0A 04 00 00 00 00 02 03
(V) 09 06 01 00 01 07 00 FF 06 00 00 24 E0 02 02 0F
(V) 00 16 1B 02 03 09 06 01 00 02 07 00 FF 06 00 00
(V) 00 00 02 02 0F 00 16 1B 02 03 09 06 01 00 03 07
(V) 00 FF 06 00 00 00 28 02 02 0F 00 16 1D 02 03 09
(V) 06 01 00 04 07 00 FF 06 00 00 00 00 02 02 0F 00
(V) 16 1D 02 03 09 06 01 00 1F 07 00 FF 10 0C 68 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 33 07 00 FF 10
(V) 00 00 02 02 0F FE 16 21 02 03 09 06 01 00 47 07
(V) 00 FF 10 0D 5D 02 02 0F FE 16 21 02 03 09 06 01
(V) 00 20 07 00 FF 12 09 2E 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 34 07 00 FF 12 00 00 02 02 0F FF 16
(V) 23 02 03 09 06 01 00 48 07 00 FF 12 09 10 02 02
(V) 0F FF 16 23
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 0D 02 02 09 06 01 01 00 02
(V) 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31 5F 31 02
(V) 02 09 06 00 00 60 01 00 FF 0A 10 31 33 39 34 33
(V) 35 39 37 00 00 00 00 00 00 00 00 02 02 09 06 00
(V) 00 60 01 07 FF 0A 04 00 00 00 00 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 E0 02 02 0F 00 16 1B
(V) 02 03 09 06 01 00 02 07 00 FF 06 00 00 00 00 02
(V) 02 0F 00 16 1B 02 03 09 06 01 00 03 07 00 FF 06
(V) 00 00 00 28 02 02 0F 00 16 1D 02 03 09 06 01 00
(V) 04 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1D 02
(V) 03 09 06 01 00 1F 07 00 FF 10 0C 68 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 33 07 00 FF 10 00 00 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 47 07 00 FF 10
(V) 0D 5D 02 02 0F FE 16 21 02 03 09 06 01 00 20 07
(V) 00 FF 12 09 2E 02 02 0F FF 16 23 02 03 09 06 01
(V) 00 34 07 00 FF 12 00 00 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 48 07 00 FF 12 09 10 02 02 0F FF 16
(V) 23
(D) Received valid DLMS at 18 +267
(V) Using application data:
(V) 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B 45 4D
(V) 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00 00 60
(V) 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00 00 00
(V) 00 00 00 00 00 02 02 09 06 00 00 60 01 07 FF 0A
(V) 04 00 00 00 00 02 03 09 06 01 00 01 07 00 FF 06
(V) 00 00 24 E0 02 02 0F 00 16 1B 02 03 09 06 01 00
(V) 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1B 02
(V) 03 09 06 01 00 03 07 00 FF 06 00 00 00 28 02 02
(V) 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF 06 00
(V) 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01 00 1F
(V) 07 00 FF 10 0C 68 02 02 0F FE 16 21 02 03 09 06
(V) 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16 21 02
(V) 03 09 06 01 00 47 07 00 FF 10 0D 5D 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 20 07 00 FF 12 09 2E 02
(V) 02 0F FF 16 23 02 03 09 06 01 00 34 07 00 FF 12
(V) 00 00 02 02 0F FF 16 23 02 03 09 06 01 00 48 07
(V) 00 FF 12 09 10 02 02 0F FF 16 23
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:16 UTC, meter clock: 00:00:00, list type 2, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 E0 02 02 0F 00 16 1B 18 A5 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 E0 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 E0 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) E0 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:17 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 A4 02 02 0F 00 16 1B 68 0D 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) A4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:20 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 A4 02 02 0F 00 16 1B 68 0D 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) A4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:22 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A1 1E 41 08 83 13 EE EE E6 E7 00 0F 40 00 00
(V) 00 00 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 45 4D 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00
(V) 00 00 00 00 00 00 00 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 5A 46 46 31 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 24 A4 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 31
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 0C 6E 02 02 0F FE 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 0D 5C 02 02
(V) 0F FE 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 38 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 00 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 10 02 02 0F FF 16 23 4A DF 7E
(V)
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 0D 02 02 09 06 01
(V) 01 00 02 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31
(V) 5F 31 02 02 09 06 00 00 60 01 00 FF 0A 10 31 33
(V) 39 34 33 35 39 37 00 00 00 00 00 00 00 00 02 02
(V) 09 06 00 00 60 01 07 FF 0A 04 5A 46 46 31 02 03
(V) 09 06 01 00 01 07 00 FF 06 00 00 24 A4 02 02 0F
(V) 00 16 1B 02 03 09 06 01 00 02 07 00 FF 06 00 00
(V) 00 00 02 02 0F 00 16 1B 02 03 09 06 01 00 03 07
(V) 00 FF 06 00 00 00 31 02 02 0F 00 16 1D 02 03 09
(V) 06 01 00 04 07 00 FF 06 00 00 00 00 02 02 0F 00
(V) 16 1D 02 03 09 06 01 00 1F 07 00 FF 10 0C 6E 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 33 07 00 FF 10
(V) 00 00 02 02 0F FE 16 21 02 03 09 06 01 00 47 07
(V) 00 FF 10 0D 5C 02 02 0F FE 16 21 02 03 09 06 01
(V) 00 20 07 00 FF 12 09 38 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 34 07 00 FF 12 00 00 02 02 0F FF 16
(V) 23 02 03 09 06 01 00 48 07 00 FF 12 09 10 02 02
(V) 0F FF 16 23
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 0D 02 02 09 06 01 01 00 02
(V) 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31 5F 31 02
(V) 02 09 06 00 00 60 01 00 FF 0A 10 31 33 39 34 33
(V) 35 39 37 00 00 00 00 00 00 00 00 02 02 09 06 00
(V) 00 60 01 07 FF 0A 04 5A 46 46 31 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V) 02 03 09 06 01 00 02 07 00 FF 06 00 00 00 00 02
(V) 02 0F 00 16 1B 02 03 09 06 01 00 03 07 00 FF 06
(V) 00 00 00 31 02 02 0F 00 16 1D 02 03 09 06 01 00
(V) 04 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1D 02
(V) 03 09 06 01 00 1F 07 00 FF 10 0C 6E 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 33 07 00 FF 10 00 00 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 47 07 00 FF 10
(V) 0D 5C 02 02 0F FE 16 21 02 03 09 06 01 00 20 07
(V) 00 FF 12 09 38 02 02 0F FF 16 23 02 03 09 06 01
(V) 00 34 07 00 FF 12 00 00 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 48 07 00 FF 12 09 10 02 02 0F FF 16
(V) 23
(D) Received valid DLMS at 18 +267
(V) Using application data:
(V) 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B 45 4D
(V) 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00 00 60
(V) 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00 00 00
(V) 00 00 00 00 00 02 02 09 06 00 00 60 01 07 FF 0A
(V) 04 5A 46 46 31 02 03 09 06 01 00 01 07 00 FF 06
(V) 00 00 24 A4 02 02 0F 00 16 1B 02 03 09 06 01 00
(V) 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1B 02
(V) 03 09 06 01 00 03 07 00 FF 06 00 00 00 31 02 02
(V) 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF 06 00
(V) 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01 00 1F
(V) 07 00 FF 10 0C 6E 02 02 0F FE 16 21 02 03 09 06
(V) 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16 21 02
(V) 03 09 06 01 00 47 07 00 FF 10 0D 5C 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 20 07 00 FF 12 09 38 02
(V) 02 0F FF 16 23 02 03 09 06 01 00 34 07 00 FF 12
(V) 00 00 02 02 0F FF 16 23 02 03 09 06 01 00 48 07
(V) 00 FF 12 09 10 02 02 0F FF 16 23
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:26 UTC, meter clock: 00:00:00, list type 2, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 B8 02 02 0F 00 16 1B 3B 09 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) B8 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:27 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 B8 02 02 0F 00 16 1B 3B 09 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) B8 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:29 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 B8 02 02 0F 00 16 1B 3B 09 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) B8 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:32 UTC, meter clock: 00:00:00, list type 1, est: 1)
q(V) HDLC frame:
(V) 7E A1 1E 41 08 83 13 EE EE E6 E7 00 0F 40 00 00
(V) 00 00 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 45 4D 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00
(V) 00 00 00 00 00 00 00 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 5A 46 46 31 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 24 A4 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 46
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 0C 67 02 02 0F FE 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 0D 5D 02 02
(V) 0F FE 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 2E 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 00 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 06 02 02 0F FF 16 23 3A 49 7E
(V)
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 0D 02 02 09 06 01
(V) 01 00 02 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31
(V) 5F 31 02 02 09 06 00 00 60 01 00 FF 0A 10 31 33
(V) 39 34 33 35 39 37 00 00 00 00 00 00 00 00 02 02
(V) 09 06 00 00 60 01 07 FF 0A 04 5A 46 46 31 02 03
(V) 09 06 01 00 01 07 00 FF 06 00 00 24 A4 02 02 0F
(V) 00 16 1B 02 03 09 06 01 00 02 07 00 FF 06 00 00
(V) 00 00 02 02 0F 00 16 1B 02 03 09 06 01 00 03 07
(V) 00 FF 06 00 00 00 46 02 02 0F 00 16 1D 02 03 09
(V) 06 01 00 04 07 00 FF 06 00 00 00 00 02 02 0F 00
(V) 16 1D 02 03 09 06 01 00 1F 07 00 FF 10 0C 67 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 33 07 00 FF 10
(V) 00 00 02 02 0F FE 16 21 02 03 09 06 01 00 47 07
(V) 00 FF 10 0D 5D 02 02 0F FE 16 21 02 03 09 06 01
(V) 00 20 07 00 FF 12 09 2E 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 34 07 00 FF 12 00 00 02 02 0F FF 16
(V) 23 02 03 09 06 01 00 48 07 00 FF 12 09 06 02 02
(V) 0F FF 16 23
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 0D 02 02 09 06 01 01 00 02
(V) 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31 5F 31 02
(V) 02 09 06 00 00 60 01 00 FF 0A 10 31 33 39 34 33
(V) 35 39 37 00 00 00 00 00 00 00 00 02 02 09 06 00
(V) 00 60 01 07 FF 0A 04 5A 46 46 31 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V) 02 03 09 06 01 00 02 07 00 FF 06 00 00 00 00 02
(V) 02 0F 00 16 1B 02 03 09 06 01 00 03 07 00 FF 06
(V) 00 00 00 46 02 02 0F 00 16 1D 02 03 09 06 01 00
(V) 04 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1D 02
(V) 03 09 06 01 00 1F 07 00 FF 10 0C 67 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 33 07 00 FF 10 00 00 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 47 07 00 FF 10
(V) 0D 5D 02 02 0F FE 16 21 02 03 09 06 01 00 20 07
(V) 00 FF 12 09 2E 02 02 0F FF 16 23 02 03 09 06 01
(V) 00 34 07 00 FF 12 00 00 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 48 07 00 FF 12 09 06 02 02 0F FF 16
(V) 23
(D) Received valid DLMS at 18 +267
(V) Using application data:
(V) 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B 45 4D
(V) 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00 00 60
(V) 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00 00 00
(V) 00 00 00 00 00 02 02 09 06 00 00 60 01 07 FF 0A
(V) 04 5A 46 46 31 02 03 09 06 01 00 01 07 00 FF 06
(V) 00 00 24 A4 02 02 0F 00 16 1B 02 03 09 06 01 00
(V) 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1B 02
(V) 03 09 06 01 00 03 07 00 FF 06 00 00 00 46 02 02
(V) 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF 06 00
(V) 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01 00 1F
(V) 07 00 FF 10 0C 67 02 02 0F FE 16 21 02 03 09 06
(V) 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16 21 02
(V) 03 09 06 01 00 47 07 00 FF 10 0D 5D 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 20 07 00 FF 12 09 2E 02
(V) 02 0F FF 16 23 02 03 09 06 01 00 34 07 00 FF 12
(V) 00 00 02 02 0F FF 16 23 02 03 09 06 01 00 48 07
(V) 00 FF 12 09 06 02 02 0F FF 16 23
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:36 UTC, meter clock: 00:00:00, list type 2, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 A4 02 02 0F 00 16 1B 68 0D 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) A4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:37 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 A4 02 02 0F 00 16 1B 68 0D 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 A4 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) A4 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:39 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 D5 02 02 0F 00 16 1B F1 83 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 D5 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 D5 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) D5 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:42 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A1 1E 41 08 83 13 EE EE E6 E7 00 0F 40 00 00
(V) 00 00 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B
(V) 45 4D 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00
(V) 00 60 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00
(V) 00 00 00 00 00 00 00 02 02 09 06 00 00 60 01 07
(V) FF 0A 04 5A 46 46 31 02 03 09 06 01 00 01 07 00
(V) FF 06 00 00 24 D5 02 02 0F 00 16 1B 02 03 09 06
(V) 01 00 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16
(V) 1B 02 03 09 06 01 00 03 07 00 FF 06 00 00 00 3C
(V) 02 02 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF
(V) 06 00 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01
(V) 00 1F 07 00 FF 10 0C 77 02 02 0F FE 16 21 02 03
(V) 09 06 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16
(V) 21 02 03 09 06 01 00 47 07 00 FF 10 0D 5F 02 02
(V) 0F FE 16 21 02 03 09 06 01 00 20 07 00 FF 12 09
(V) 2E 02 02 0F FF 16 23 02 03 09 06 01 00 34 07 00
(V) FF 12 00 00 02 02 0F FF 16 23 02 03 09 06 01 00
(V) 48 07 00 FF 12 09 06 02 02 0F FF 16 23 4A 9D 7E
(V)
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 0D 02 02 09 06 01
(V) 01 00 02 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31
(V) 5F 31 02 02 09 06 00 00 60 01 00 FF 0A 10 31 33
(V) 39 34 33 35 39 37 00 00 00 00 00 00 00 00 02 02
(V) 09 06 00 00 60 01 07 FF 0A 04 5A 46 46 31 02 03
(V) 09 06 01 00 01 07 00 FF 06 00 00 24 D5 02 02 0F
(V) 00 16 1B 02 03 09 06 01 00 02 07 00 FF 06 00 00
(V) 00 00 02 02 0F 00 16 1B 02 03 09 06 01 00 03 07
(V) 00 FF 06 00 00 00 3C 02 02 0F 00 16 1D 02 03 09
(V) 06 01 00 04 07 00 FF 06 00 00 00 00 02 02 0F 00
(V) 16 1D 02 03 09 06 01 00 1F 07 00 FF 10 0C 77 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 33 07 00 FF 10
(V) 00 00 02 02 0F FE 16 21 02 03 09 06 01 00 47 07
(V) 00 FF 10 0D 5F 02 02 0F FE 16 21 02 03 09 06 01
(V) 00 20 07 00 FF 12 09 2E 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 34 07 00 FF 12 00 00 02 02 0F FF 16
(V) 23 02 03 09 06 01 00 48 07 00 FF 12 09 06 02 02
(V) 0F FF 16 23
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 0D 02 02 09 06 01 01 00 02
(V) 81 FF 0A 0B 45 4D 42 52 49 51 5F 56 31 5F 31 02
(V) 02 09 06 00 00 60 01 00 FF 0A 10 31 33 39 34 33
(V) 35 39 37 00 00 00 00 00 00 00 00 02 02 09 06 00
(V) 00 60 01 07 FF 0A 04 5A 46 46 31 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 D5 02 02 0F 00 16 1B
(V) 02 03 09 06 01 00 02 07 00 FF 06 00 00 00 00 02
(V) 02 0F 00 16 1B 02 03 09 06 01 00 03 07 00 FF 06
(V) 00 00 00 3C 02 02 0F 00 16 1D 02 03 09 06 01 00
(V) 04 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1D 02
(V) 03 09 06 01 00 1F 07 00 FF 10 0C 77 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 33 07 00 FF 10 00 00 02
(V) 02 0F FE 16 21 02 03 09 06 01 00 47 07 00 FF 10
(V) 0D 5F 02 02 0F FE 16 21 02 03 09 06 01 00 20 07
(V) 00 FF 12 09 2E 02 02 0F FF 16 23 02 03 09 06 01
(V) 00 34 07 00 FF 12 00 00 02 02 0F FF 16 23 02 03
(V) 09 06 01 00 48 07 00 FF 12 09 06 02 02 0F FF 16
(V) 23
(D) Received valid DLMS at 18 +267
(V) Using application data:
(V) 01 0D 02 02 09 06 01 01 00 02 81 FF 0A 0B 45 4D
(V) 42 52 49 51 5F 56 31 5F 31 02 02 09 06 00 00 60
(V) 01 00 FF 0A 10 31 33 39 34 33 35 39 37 00 00 00
(V) 00 00 00 00 00 02 02 09 06 00 00 60 01 07 FF 0A
(V) 04 5A 46 46 31 02 03 09 06 01 00 01 07 00 FF 06
(V) 00 00 24 D5 02 02 0F 00 16 1B 02 03 09 06 01 00
(V) 02 07 00 FF 06 00 00 00 00 02 02 0F 00 16 1B 02
(V) 03 09 06 01 00 03 07 00 FF 06 00 00 00 3C 02 02
(V) 0F 00 16 1D 02 03 09 06 01 00 04 07 00 FF 06 00
(V) 00 00 00 02 02 0F 00 16 1D 02 03 09 06 01 00 1F
(V) 07 00 FF 10 0C 77 02 02 0F FE 16 21 02 03 09 06
(V) 01 00 33 07 00 FF 10 00 00 02 02 0F FE 16 21 02
(V) 03 09 06 01 00 47 07 00 FF 10 0D 5F 02 02 0F FE
(V) 16 21 02 03 09 06 01 00 20 07 00 FF 12 09 2E 02
(V) 02 0F FF 16 23 02 03 09 06 01 00 34 07 00 FF 12
(V) 00 00 02 02 0F FF 16 23 02 03 09 06 01 00 48 07
(V) 00 FF 12 09 06 02 02 0F FF 16 23
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:46 UTC, meter clock: 00:00:00, list type 2, est: 1)
qq(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 D5 02 02 0F 00 16 1B F1 83 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 D5 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 D5 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) D5 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:47 UTC, meter clock: 00:00:00, list type 1, est: 1)
q
* Debug: Command received: qqqqq
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 B8 02 02 0F 00 16 1B 3B 09 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) B8 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:49 UTC, meter clock: 00:00:00, list type 1, est: 1)
(V) HDLC frame:
(V) 7E A0 2A 41 08 83 13 04 13 E6 E7 00 0F 40 00 00
(V) 00 00 01 01 02 03 09 06 01 00 01 07 00 FF 06 00
(V) 00 24 B8 02 02 0F 00 16 1B 3B 09 7E
(V) LLC frame:
(V) E6 E7 00 0F 40 00 00 00 00 01 01 02 03 09 06 01
(V) 00 01 07 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(V)
(V) DLMS frame:
(V) 0F 40 00 00 00 00 01 01 02 03 09 06 01 00 01 07
(V) 00 FF 06 00 00 24 B8 02 02 0F 00 16 1B
(D) Received valid DLMS at 18 +23
(V) Using application data:
(V) 01 01 02 03 09 06 01 00 01 07 00 FF 06 00 00 24
(V) B8 02 02 0F 00 16 1B
(V) DLMS
(D) NOT Ready to update (internal clock 12:32:51 UTC, meter clock: 00:00:00, list type 1, est: 1)
q
* Debug: Command received: q
* Closing client connection ...

View File

@@ -42,4 +42,4 @@ DB
09 06 01 00 47 07 00 FF 12 00 54 02 02 0F FE 16 21
09 06 01 00 0D 07 00 FF 10 03 CF 02 02 0F FD 16 FF // Power factor
09 0C 31 37 38 32 31 30 30 31 35 31 36 35 // Meter ID
01 67
01 67

1
frames/dsmr.raw Normal file
View File

@@ -0,0 +1 @@
2F454C4C355C3235333833333633355F410D0A0D0A302D303A312E302E302832343132313232303133343857290D0A312D303A312E382E302830303034373532322E3237382A6B5768290D0A312D303A322E382E302830303030303030302E3030312A6B5768290D0A312D303A332E382E302830303030303035392E3033392A6B76617268290D0A312D303A342E382E302830303031323537302E3937362A6B76617268290D0A312D303A312E372E3028303030312E3233312A6B57290D0A312D303A322E372E3028303030302E3030302A6B57290D0A312D303A332E372E3028303030302E3030302A6B766172290D0A312D303A342E372E3028303030302E3435312A6B766172290D0A312D303A32312E372E3028303030302E3337362A6B57290D0A312D303A34312E372E3028303030302E3832342A6B57290D0A312D303A36312E372E3028303030302E3033302A6B57290D0A312D303A32322E372E3028303030302E3030302A6B57290D0A312D303A34322E372E3028303030302E3030302A6B57290D0A312D303A36322E372E3028303030302E3030302A6B57290D0A312D303A32332E372E3028303030302E3030302A6B766172290D0A312D303A34332E372E3028303030302E3030302A6B766172290D0A312D303A36332E372E3028303030302E3030302A6B766172290D0A312D303A32342E372E3028303030302E3037322A6B766172290D0A312D303A34342E372E3028303030302E3334392A6B766172290D0A312D303A36342E372E3028303030302E3032392A6B766172290D0A312D303A33322E372E30283233322E382A56290D0A312D303A35322E372E30283233332E352A56290D0A312D303A37322E372E30283233382E352A56290D0A312D303A33312E372E30283030312E382A41290D0A312D303A35312E372E30283030342E302A41290D0A312D303A37312E372E30283030302E312A41290D0A21343736300D0A

48
frames/iskra_croatia.txt Normal file
View File

@@ -0,0 +1,48 @@
They actually use multiple frames, so this is a "fake" frame combining the two into one, but without checksum fields.
7E
A0 BD
CF 02 23 03 00 00
E6 E7 00
0F 00 03 46 3B
0C 07 E9 0C 13 05 17 37 28 00 FF C4 00
02 21
09 08 39 32 30 32 39 36 39 31
09 04 17 37 28 00
09 05 07 E9 0C 13 05
06 00 6C 28 5A
06 00 4B 76 1A
06 00 20 B2 40
06 00 58 68 AA
06 00 57 A1 62
06 00 00 C7 48
06 00 17 EE D7
06 00 12 F5 5C
06 00 00 D9 6A
06 00 15 36 84
06 00 00 01 7E
06 00 00 00 00
12 03 79
06 00 00 00 7F
06 00 00 00 BD
06 00 00 00 41
06 00 00 00 00
06 00 00 00 00
06 00 00 00 00
12 09 54
12 09 35
12 09 49
12 00 37
12 00 59
12 00 4D
06 00 00 43 62
01 01
12 24 B8
01 01
12 24 B8
01 01
12 24 B8
03 01
00 00 7E

View File

@@ -43,3 +43,37 @@ FF // Last byte of OBIS in previous block
0600000000 // Accumulated export
8BA4
7E
7E A1 23 CE FF 03 13 21 55 E6 E7 00
0F 00 00 08 E2
0C 07 E5 07 13 01 0C 1A 0A FF 80 00 00
02 0B // 11
01 0B // 11
02 04 12 00 28 09 06 00 08 19 09 00 FF 0F 02 12 00 00
02 04 12 00 28 09 06 00 08 19 09 00 FF 0F 01 12 00 00
02 04 12 00 01 09 06 00 00 60 01 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 00 01 07 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 00 02 07 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 01 08 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 02 08 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 05 08 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 06 08 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 07 08 00 FF 0F 02 12 00 00
02 04 12 00 03 09 06 01 01 08 08 00 FF 0F 02 12 00 00
09 06 00 08 19 09 00 FF
09 08 34 33 30 39 34 33 35 31
06 00 00 00 0B
06 00 00 00 00
06 00 00 00 10
06 00 00 00 04
06 00 00 00 00
06 00 00 00 08
06 00 00 00 00
06 00 00 00 01
7C 8B
7E

33
frames/lng2.raw Normal file
View File

@@ -0,0 +1,33 @@
7E
A0 76 CE FF 03 13 3C 02 E6 E7 00
DB
08 4C 47 5A 67 72 A9 A1 11
5E 30 00 21 80 F7 FE B8 07 C6
72 B1 90 AE AC 15 D0 AD 95 7B AC 13 7E 67 D8 A2
F0 43 51 3C 63 B6 A1 89 10 AE 9A 7E 55 4A 12 49
B9 6D EB A5 7B 57 03 69 9A BF 16 5E AD 2A 54 41
65 5E 79 C6 95 71 92 46 A2 3F 5B 63 0D 53 96 7D
42 52 1F A3 80 1C 00 E8 E3
A4 B3 9B 86 CB E5 2D 2C CA B0 E2 B7
AE 4D
7E
0f00057e41 // UI Frame header
0c07e60c0c010c232dff800000 // Date & time
020e // Structure with 14 items
1200ec // U1 = 236 V
1200ec // U2 = 236 V
1200ec // U3 = 236 V
120000 // I1 = 0.00 A
12002e // I2 = 0.46 A
12001a // I3 = 0.26 A
060000007d // Active import = 125 W
0600000000 // Active export = 0 W
0601a96ebd // Accumulated import = 27881.149 kWh
0600001dc3 // Accumulated export = 7.619 kWh
120190 // 400 ?
120003 // 3 ?
120120 // 288 ?
09083330313337313831 // Meter ID = 30137181

34
frames/slovenia-iskra.raw Normal file
View File

@@ -0,0 +1,34 @@
02 12
09 10 49 53 4B 31 30 33 30 37 38 39 33 37 35 36 30 36 // str: ISK1030789375606 (device name)
09 08 31 36 38 32 30 30 30 35 // str: 16820005 (device id)
06 00 00 05 71 // active import
06 00 00 00 00 // active export
06 00 00 00 00 // reactive import
06 00 00 02 E2 // reactive export
12 09 4B // U1
12 09 4B // U2
12 08 F8 // U3
12 00 67 // I1
12 00 7D // I2
12 02 55 // I3
06 00 00 00 10 // L1 a+
06 00 00 00 33 // L2 a+
06 00 00 05 2D // L3 a+
06 00 00 00 00 // L1 a-
06 00 00 00 00 // L2 a-
06 00 00 00 00 // L3 a-
02 0C
09 10 49 53 4B 31 30 33 30 37 38 39 33 37 35 36 30 36
09 08 31 36 38 32 30 30 30 36
16 01 // Disconnect control
09 02 00 01 // Currently active energy tariff
06 00 00 CE 65 // 1.8.0 a+
06 00 00 35 19 // 1.8.1
06 00 00 99 4C // 1.8.2
06 00 02 B7 07 // 2.8.0 a-
06 00 01 33 17 // 2.8.1
06 00 01 83 F0 // 2.8.2
06 00 01 A5 6A // q+
06 00 00 A8 F5 // q-

View File

@@ -1 +1 @@
[See Hardware page in Wiki](https://github.com/gskjold/AmsToMqttBridge/wiki)
[See Hardware page in Wiki](https://github.com/UtilitechAS/amsreader-firmware/wiki)

View File

@@ -0,0 +1,76 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"pads": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"ratsnest_display_mode": 0,
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": true,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
0,
1,
2,
3,
4,
5,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
35,
36
],
"visible_layers": "fffffff_ffffffff",
"zone_display_mode": 0
},
"meta": {
"filename": "HAN_ESP_TSS721.kicad_prl",
"version": 3
},
"project": {
"files": []
}
}

View File

@@ -0,0 +1,440 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.15,
"copper_line_width": 0.19999999999999998,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": false,
"courtyard_line_width": 0.049999999999999996,
"dimension_precision": 4,
"dimension_units": 3,
"dimensions": {
"arrow_length": 1270000,
"extension_offset": 500000,
"keep_text_aligned": true,
"suppress_zeroes": false,
"text_position": 0,
"units_format": 1
},
"fab_line_width": 0.09999999999999999,
"fab_text_italic": false,
"fab_text_size_h": 1.0,
"fab_text_size_v": 1.0,
"fab_text_thickness": 0.15,
"fab_text_upright": false,
"other_line_width": 0.09999999999999999,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": false,
"pads": {
"drill": 0.762,
"height": 1.524,
"width": 1.524
},
"silk_line_width": 0.15,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15,
"silk_text_upright": false,
"zones": {
"45_degree_only": true,
"min_clearance": 0.508
}
},
"diff_pair_dimensions": [],
"drc_exclusions": [],
"meta": {
"filename": "board_design_settings.json",
"version": 2
},
"rule_severities": {
"annular_width": "error",
"clearance": "error",
"copper_edge_clearance": "error",
"courtyards_overlap": "error",
"diff_pair_gap_out_of_range": "error",
"diff_pair_uncoupled_length_too_long": "error",
"drill_out_of_range": "error",
"duplicate_footprints": "warning",
"extra_footprint": "warning",
"footprint_type_mismatch": "error",
"hole_clearance": "error",
"hole_near_hole": "error",
"invalid_outline": "error",
"item_on_disabled_layer": "error",
"items_not_allowed": "error",
"length_out_of_range": "error",
"malformed_courtyard": "error",
"microvia_drill_out_of_range": "error",
"missing_courtyard": "ignore",
"missing_footprint": "warning",
"net_conflict": "warning",
"npth_inside_courtyard": "ignore",
"padstack": "error",
"pth_inside_courtyard": "ignore",
"shorting_items": "error",
"silk_over_copper": "warning",
"silk_overlap": "warning",
"skew_out_of_range": "error",
"through_hole_pad_without_hole": "error",
"too_many_vias": "error",
"track_dangling": "warning",
"track_width": "error",
"tracks_crossing": "error",
"unconnected_items": "error",
"unresolved_variable": "error",
"via_dangling": "warning",
"zone_has_empty_net": "error",
"zones_intersect": "error"
},
"rules": {
"allow_blind_buried_vias": false,
"allow_microvias": false,
"max_error": 0.005,
"min_clearance": 0.0,
"min_copper_edge_clearance": 0.075,
"min_hole_clearance": 0.25,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.19999999999999998,
"min_microvia_drill": 0.09999999999999999,
"min_silk_clearance": 0.0,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.19999999999999998,
"min_via_annular_width": 0.049999999999999996,
"min_via_diameter": 0.39999999999999997,
"use_height_for_length_calcs": true
},
"track_widths": [
0.0,
0.2,
0.4,
0.6,
1.0
],
"via_dimensions": [],
"zones_allow_external_fillets": false,
"zones_use_no_outline": true
},
"layer_presets": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "HAN_ESP_TSS721.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.6,
"via_drill": 0.4,
"wire_width": 6.0
},
{
"bus_width": 12.0,
"clearance": 0.5,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.5,
"microvia_drill": 0.2,
"name": "PWR",
"nets": [
"+3V3"
],
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.5,
"via_diameter": 0.8,
"via_drill": 0.6,
"wire_width": 6.0
}
],
"meta": {
"version": 2
},
"net_colors": null
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.25,
"pin_symbol_size": 0.0,
"text_offset_ratio": 0.08
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [],
"text_variables": {}
}

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
EESchema-DOCLIB Version 2.0
#
#End Doc Library

View File

@@ -1,6 +1,21 @@
EESchema-LIBRARY Version 2.4
#encoding utf-8
#
# +3.3V-power
#
DEF +3.3V-power #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -150 50 H I C CNN
F1 "+3.3V-power" 0 140 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
DRAW
P 2 0 1 0 -30 50 0 100 N
P 2 0 1 0 0 0 0 100 N
P 2 0 1 0 0 100 30 50 N
X +3V3 1 0 0 0 U 50 50 1 1 W N
ENDDRAW
ENDDEF
#
# CONN_01X08
#
DEF CONN_01X08 P 0 40 Y N 1 F N
@@ -35,4 +50,23 @@ X P8 8 -200 -350 150 R 50 50 1 1 P
ENDDRAW
ENDDEF
#
# Jumper-Device
#
DEF Jumper-Device JP 0 30 Y N 1 F N
F0 "JP" 0 150 50 H V C CNN
F1 "Jumper-Device" 0 -80 50 H V C CNN
F2 "" 0 0 50 H I C CNN
F3 "" 0 0 50 H I C CNN
$FPLIST
SolderJumper*
$ENDFPLIST
DRAW
C -100 0 35 0 1 0 N
A 0 -26 125 375 1422 0 1 0 N 99 50 -98 50
C 100 0 35 0 1 0 N
X 1 1 -300 0 165 R 50 50 0 1 P
X 2 2 300 0 165 L 50 50 0 1 P
ENDDRAW
ENDDEF
#
#End Library

View File

@@ -0,0 +1,75 @@
{
"board": {
"active_layer": 0,
"active_layer_preset": "",
"auto_track_width": true,
"hidden_nets": [],
"high_contrast_mode": 0,
"net_color_mode": 1,
"opacity": {
"pads": 1.0,
"tracks": 1.0,
"vias": 1.0,
"zones": 0.6
},
"ratsnest_display_mode": 0,
"selection_filter": {
"dimensions": true,
"footprints": true,
"graphics": true,
"keepouts": true,
"lockedItems": true,
"otherItems": true,
"pads": true,
"text": true,
"tracks": true,
"vias": true,
"zones": true
},
"visible_items": [
0,
1,
2,
3,
4,
5,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
32,
33,
34,
35,
36
],
"visible_layers": "fffffff_ffffffff",
"zone_display_mode": 0
},
"meta": {
"filename": "d1_mini_shield.kicad_prl",
"version": 3
},
"project": {
"files": []
}
}

View File

@@ -0,0 +1,356 @@
{
"board": {
"design_settings": {
"defaults": {
"board_outline_line_width": 0.15,
"copper_line_width": 0.2,
"copper_text_italic": false,
"copper_text_size_h": 1.5,
"copper_text_size_v": 1.5,
"copper_text_thickness": 0.3,
"copper_text_upright": true,
"courtyard_line_width": 0.05,
"other_line_width": 0.15,
"other_text_italic": false,
"other_text_size_h": 1.0,
"other_text_size_v": 1.0,
"other_text_thickness": 0.15,
"other_text_upright": true,
"silk_line_width": 0.15,
"silk_text_italic": false,
"silk_text_size_h": 1.0,
"silk_text_size_v": 1.0,
"silk_text_thickness": 0.15,
"silk_text_upright": true
},
"diff_pair_dimensions": [
{
"gap": 0.25,
"via_gap": 0.25,
"width": 0.2
}
],
"drc_exclusions": [],
"rule_severitieslegacy_courtyards_overlap": true,
"rule_severitieslegacy_no_courtyard_defined": false,
"rules": {
"allow_blind_buried_vias": false,
"allow_microvias": false,
"min_hole_to_hole": 0.25,
"min_microvia_diameter": 0.2,
"min_microvia_drill": 0.09999999999999999,
"min_through_hole_diameter": 0.3,
"min_track_width": 0.2,
"min_via_diameter": 0.4,
"solder_mask_clearance": 0.2,
"solder_mask_min_width": 0.0,
"solder_paste_clearance": 0.0,
"solder_paste_margin_ratio": -0.0
},
"track_widths": [
0.25,
0.5
],
"via_dimensions": [
{
"diameter": 0.6,
"drill": 0.4
}
]
},
"layer_presets": []
},
"boards": [],
"cvpcb": {
"equivalence_files": []
},
"erc": {
"erc_exclusions": [],
"meta": {
"version": 0
},
"pin_map": [
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
1,
0,
1,
2
],
[
0,
1,
0,
0,
0,
0,
1,
1,
2,
1,
1,
2
],
[
0,
0,
0,
0,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
2
],
[
1,
1,
1,
1,
1,
0,
1,
1,
1,
1,
1,
2
],
[
0,
0,
0,
1,
0,
0,
1,
0,
0,
0,
0,
2
],
[
0,
2,
1,
2,
0,
0,
1,
0,
2,
2,
2,
2
],
[
0,
2,
0,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
0,
2,
1,
1,
0,
0,
1,
0,
2,
0,
0,
2
],
[
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2,
2
]
],
"rule_severities": {
"bus_definition_conflict": "error",
"bus_entry_needed": "error",
"bus_label_syntax": "error",
"bus_to_bus_conflict": "error",
"bus_to_net_conflict": "error",
"different_unit_footprint": "error",
"different_unit_net": "error",
"duplicate_reference": "error",
"duplicate_sheet_names": "error",
"extra_units": "error",
"global_label_dangling": "warning",
"hier_label_mismatch": "error",
"label_dangling": "error",
"lib_symbol_issues": "warning",
"multiple_net_names": "warning",
"net_not_bus_member": "warning",
"no_connect_connected": "warning",
"no_connect_dangling": "warning",
"pin_not_connected": "error",
"pin_not_driven": "error",
"pin_to_pin": "warning",
"power_pin_not_driven": "error",
"similar_labels": "warning",
"unannotated": "error",
"unit_value_mismatch": "error",
"unresolved_variable": "error",
"wire_dangling": "error"
}
},
"libraries": {
"pinned_footprint_libs": [],
"pinned_symbol_libs": []
},
"meta": {
"filename": "d1_mini_shield.kicad_pro",
"version": 1
},
"net_settings": {
"classes": [
{
"bus_width": 12.0,
"clearance": 0.2,
"diff_pair_gap": 0.25,
"diff_pair_via_gap": 0.25,
"diff_pair_width": 0.2,
"line_style": 0,
"microvia_diameter": 0.3,
"microvia_drill": 0.1,
"name": "Default",
"pcb_color": "rgba(0, 0, 0, 0.000)",
"schematic_color": "rgba(0, 0, 0, 0.000)",
"track_width": 0.25,
"via_diameter": 0.8,
"via_drill": 0.4,
"wire_width": 6.0
}
],
"meta": {
"version": 2
},
"net_colors": null
},
"pcbnew": {
"last_paths": {
"gencad": "",
"idf": "",
"netlist": "d1_mini_shield.net",
"specctra_dsn": "",
"step": "",
"vrml": ""
},
"page_layout_descr_file": ""
},
"schematic": {
"annotate_start_num": 0,
"drawing": {
"default_line_thickness": 6.0,
"default_text_size": 50.0,
"field_names": [],
"intersheets_ref_own_page": false,
"intersheets_ref_prefix": "",
"intersheets_ref_short": false,
"intersheets_ref_show": false,
"intersheets_ref_suffix": "",
"junction_size_choice": 3,
"label_size_ratio": 0.25,
"pin_symbol_size": 0.0,
"text_offset_ratio": 0.08
},
"legacy_lib_dir": "",
"legacy_lib_list": [],
"meta": {
"version": 1
},
"net_format_name": "Pcbnew",
"ngspice": {
"fix_include_paths": true,
"fix_passive_vals": false,
"meta": {
"version": 0
},
"model_mode": 0,
"workbook_filename": ""
},
"page_layout_descr_file": "",
"plot_directory": "",
"spice_adjust_passive_values": false,
"spice_external_command": "spice \"%I\"",
"subpart_first_id": 65,
"subpart_id_separator": 0
},
"sheets": [],
"text_variables": {}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 199 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@@ -0,0 +1,401 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _AMSCONFIGURATION_h
#define _AMSCONFIGURATION_h
#include <EEPROM.h>
#include "Arduino.h"
#define EEPROM_SIZE 1024*3
#define EEPROM_CHECK_SUM 104 // Used to check if config is stored. Change if structure changes
#define EEPROM_CLEARED_INDICATOR 0xFC
#define EEPROM_CONFIG_ADDRESS 0
#define CONFIG_SYSTEM_START 8
#define CONFIG_NETWORK_START 40
#define CONFIG_METER_START 296
#define CONFIG_GPIO_START 368
#define CONFIG_PRICE_START 400
#define CONFIG_ENERGYACCOUNTING_START 472
#define CONFIG_WEB_START 496
#define CONFIG_DEBUG_START 632
#define CONFIG_NTP_START 640
#define CONFIG_MQTT_START 768
#define CONFIG_DOMOTICZ_START 1536
#define CONFIG_HA_START 1552
#define CONFIG_UI_START 1720
#define CONFIG_CLOUD_START 1742
#define CONFIG_UPGRADE_INFO_START 1934
#define CONFIG_ZC_START 2000
#define CONFIG_METER_START_103 32
#define CONFIG_UPGRADE_INFO_START_103 216
#define CONFIG_UI_START_103 248
#define CONFIG_GPIO_START_103 266
#define CONFIG_ENTSOE_START_103 290
#define CONFIG_WIFI_START_103 360
#define CONFIG_ENERGYACCOUNTING_START_103 576
#define CONFIG_WEB_START_103 648
#define CONFIG_DEBUG_START_103 824
#define CONFIG_DOMOTICZ_START_103 856
#define CONFIG_NTP_START_103 872
#define CONFIG_MQTT_START_103 1004
#define CONFIG_HA_START_103 1680
#define LED_BEHAVIOUR_DEFAULT 0
#define LED_BEHAVIOUR_BOOT 1
#define LED_BEHAVIOUR_ERROR_ONLY 3
#define LED_BEHAVIOUR_OFF 9
#define FIRMWARE_CHANNEL_STABLE 0
#define FIRMWARE_CHANNEL_EARLY 1
#define FIRMWARE_CHANNEL_RC 2
#define FIRMWARE_CHANNEL_SNAPSHOT 3
#define REBOOT_CAUSE_WEB_SYSINFO_JSON 1
#define REBOOT_CAUSE_WEB_SAVE 2
#define REBOOT_CAUSE_WEB_REBOOT 3
#define REBOOT_CAUSE_WEB_FACTORY_RESET 4
#define REBOOT_CAUSE_BTN_FACTORY_RESET 5
#define REBOOT_CAUSE_REPARTITION 6
#define REBOOT_CAUSE_CONFIG_FILE_UPDATE 7
#define REBOOT_CAUSE_FIRMWARE_UPDATE 8
#define REBOOT_CAUSE_MQTT_DISCONNECTED 9
#define REBOOT_CAUSE_SMART_CONFIG 10
struct ResetDataContainer {
uint8_t cause;
uint8_t last_cause;
uint8_t magic;
};
struct SystemConfig {
uint8_t boardType;
bool vendorConfigured;
bool userConfigured;
uint8_t dataCollectionConsent; // 0 = unknown, 1 = accepted, 2 = declined
char country[3];
uint8_t energyspeedometer;
uint8_t firmwareChannel;
}; // 9
struct NetworkConfig {
char ssid[32];
char psk[64];
char ip[16];
char gateway[16];
char subnet[16];
char dns1[16];
char dns2[16];
char hostname[32];
bool mdns;
uint8_t power;
uint8_t sleep;
uint8_t use11b;
bool ipv6;
uint8_t mode;
}; // 214
struct MqttConfig {
char host[128];
uint16_t port;
char clientId[32];
char publishTopic[64];
char subscribeTopic[64];
char username[128];
char password[256];
uint8_t payloadFormat;
bool ssl;
uint8_t magic;
bool stateUpdate;
uint16_t stateUpdateInterval;
uint16_t timeout;
uint8_t keepalive;
uint8_t rebootMinutes;
}; // 684
struct WebConfig {
uint8_t security;
char username[37];
char password[37];
char context[37];
}; // 112
struct WebConfig103 {
uint8_t security;
char username[64];
char password[64];
}; // 129
struct MeterConfig {
uint32_t baud;
uint8_t parity;
bool invert;
uint8_t distributionSystem;
uint16_t mainFuse;
uint16_t productionCapacity;
uint8_t encryptionKey[16];
uint8_t authenticationKey[16];
uint32_t wattageMultiplier;
uint32_t voltageMultiplier;
uint32_t amperageMultiplier;
uint32_t accumulatedMultiplier;
uint8_t source;
uint8_t parser;
uint8_t bufferSize;
uint8_t rxPin;
bool rxPinPullup;
uint8_t txPin;
}; // 65
struct DebugConfig {
bool telnet;
bool serial;
uint8_t level;
}; // 3
struct GpioConfig {
uint8_t apPin;
uint8_t ledPin;
bool ledInverted;
uint8_t ledPinRed;
uint8_t ledPinGreen;
uint8_t ledPinBlue;
bool ledRgbInverted;
uint8_t tempSensorPin;
uint8_t tempAnalogSensorPin;
uint8_t vccPin;
int16_t vccOffset;
uint16_t vccMultiplier;
uint8_t vccBootLimit;
uint16_t vccResistorGnd;
uint16_t vccResistorVcc;
uint8_t ledDisablePin;
uint8_t ledBehaviour;
uint8_t powersaving;
}; // 22
struct GpioConfig103 {
uint8_t hanPin;
uint8_t apPin;
uint8_t ledPin;
bool ledInverted;
uint8_t ledPinRed;
uint8_t ledPinGreen;
uint8_t ledPinBlue;
bool ledRgbInverted;
uint8_t tempSensorPin;
uint8_t tempAnalogSensorPin;
uint8_t vccPin;
int16_t vccOffset;
uint16_t vccMultiplier;
uint8_t vccBootLimit;
uint16_t vccResistorGnd;
uint16_t vccResistorVcc;
bool hanPinPullup;
uint8_t ledDisablePin;
uint8_t ledBehaviour;
}; // 23
struct DomoticzConfig {
uint16_t elidx;
uint16_t vl1idx;
uint16_t vl2idx;
uint16_t vl3idx;
uint16_t cl1idx;
}; // 10
struct HomeAssistantConfig {
char discoveryPrefix[64];
char discoveryHostname[64];
char discoveryNameTag[16];
}; // 145
struct NtpConfig {
bool enable;
bool dhcp;
char server[64];
char timezone[32];
}; // 98
struct PriceServiceConfig {
char entsoeToken[37];
char area[17];
char currency[4];
uint8_t resolutionInMinutes;
uint16_t unused2;
uint16_t unused3;
bool enabled;
uint16_t unused6;
};
struct EnergyAccountingConfig {
uint16_t thresholds[10];
uint8_t hours;
}; // 21
struct UiConfig {
uint8_t showImport;
uint8_t showExport;
uint8_t showVoltage;
uint8_t showAmperage;
uint8_t showReactive;
uint8_t showRealtime;
uint8_t showPeaks;
uint8_t showPricePlot;
uint8_t showDayPlot;
uint8_t showMonthPlot;
uint8_t showTemperaturePlot;
uint8_t showRealtimePlot;
uint8_t showPerPhasePower;
uint8_t showPowerFactor;
uint8_t darkMode;
char language[3];
}; // 15
struct UpgradeInformation {
char fromVersion[16];
char toVersion[16];
uint32_t size;
uint16_t block_position;
uint8_t retry_count;
uint8_t reboot_count;
int8_t errorCode;
}; // 41+3
struct CloudConfig {
bool enabled;
uint8_t interval;
char hostname[64];
uint16_t port;
uint8_t clientId[16];
uint8_t proto;
}; // 88
struct ZmartChargeConfig {
bool enabled;
char token[21];
char baseUrl[64];
}; // 86
class AmsConfiguration {
public:
bool hasConfig();
int getConfigVersion();
bool save();
bool getSystemConfig(SystemConfig&);
bool setSystemConfig(SystemConfig&);
bool isSystemConfigChanged();
void ackSystemConfigChanged();
bool getNetworkConfig(NetworkConfig&);
bool setNetworkConfig(NetworkConfig&);
void clearNetworkConfig(NetworkConfig&);
void clearNetworkConfigIp(NetworkConfig&);
bool isNetworkConfigChanged();
void ackNetworkConfigChange();
bool getMqttConfig(MqttConfig&);
bool setMqttConfig(MqttConfig&);
void clearMqtt(MqttConfig&);
void setMqttChanged();
bool isMqttChanged();
void ackMqttChange();
bool getWebConfig(WebConfig&);
bool setWebConfig(WebConfig&);
void clearWebConfig(WebConfig&);
bool isWebChanged();
void ackWebChange();
bool getMeterConfig(MeterConfig&);
bool setMeterConfig(MeterConfig&);
void clearMeter(MeterConfig&);
void setMeterChanged();
bool isMeterChanged();
void ackMeterChanged();
bool getDebugConfig(DebugConfig&);
bool setDebugConfig(DebugConfig&);
void clearDebug(DebugConfig&);
bool pinUsed(uint8_t, GpioConfig&);
bool getGpioConfig(GpioConfig&);
bool setGpioConfig(GpioConfig&);
void clearGpio(GpioConfig& config, bool all=true);
void print(Print* debugger);
bool getDomoticzConfig(DomoticzConfig&);
bool setDomoticzConfig(DomoticzConfig&);
void clearDomo(DomoticzConfig&);
bool getHomeAssistantConfig(HomeAssistantConfig&);
bool setHomeAssistantConfig(HomeAssistantConfig&);
void clearHomeAssistantConfig(HomeAssistantConfig&);
bool getNtpConfig(NtpConfig&);
bool setNtpConfig(NtpConfig&);
void clearNtp(NtpConfig&);
bool isNtpChanged();
void ackNtpChange();
bool getPriceServiceConfig(PriceServiceConfig&);
bool setPriceServiceConfig(PriceServiceConfig&);
void clearPriceServiceConfig(PriceServiceConfig&);
bool isPriceServiceChanged();
void ackPriceServiceChange();
bool getEnergyAccountingConfig(EnergyAccountingConfig&);
bool setEnergyAccountingConfig(EnergyAccountingConfig&);
void clearEnergyAccountingConfig(EnergyAccountingConfig&);
bool isEnergyAccountingChanged();
void ackEnergyAccountingChange();
bool getUiConfig(UiConfig&);
bool setUiConfig(UiConfig&);
void clearUiConfig(UiConfig&);
void setUiLanguageChanged();
bool isUiLanguageChanged();
void ackUiLanguageChange();
bool getUpgradeInformation(UpgradeInformation&);
bool setUpgradeInformation(UpgradeInformation&);
void clearUpgradeInformation(UpgradeInformation&);
bool getCloudConfig(CloudConfig&);
bool setCloudConfig(CloudConfig&);
void clearCloudConfig(CloudConfig&);
bool isCloudChanged();
void ackCloudConfig();
bool getZmartChargeConfig(ZmartChargeConfig&);
bool setZmartChargeConfig(ZmartChargeConfig&);
void clearZmartChargeConfig(ZmartChargeConfig&);
bool isZmartChargeConfigChanged();
void ackZmartChargeConfig();
void clear();
protected:
private:
uint8_t configVersion = 0;
bool sysChanged = false, networkChanged = false, mqttChanged = false, webChanged = false, meterChanged = true, ntpChanged = true, priceChanged = false, energyAccountingChanged = true, cloudChanged = true, uiLanguageChanged = false, zcChanged = true;
bool relocateConfig103(); // 2.2.12, until, but not including 2.3
void saveToFs();
bool loadFromFs(uint8_t version);
void deleteFromFs(uint8_t version);
};
#endif

View File

@@ -1,7 +1,13 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _AMSSTORAGE_H
#define _AMSSTORAGE_H
#define FILE_FIRMWARE "/firmware.bin"
#define FILE_FIRMWARE_DELETE "/firmware.bin"
#define FILE_MQTT_CA "/mqtt-ca.pem"
#define FILE_MQTT_CERT "/mqtt-cert.pem"
@@ -12,5 +18,6 @@
#define FILE_ENERGYACCOUNTING "/energyaccounting.bin"
#define FILE_CFG "/configfile.cfg"
#define FILE_PRICE_CONF "/priceconf.bin"
#endif

View File

@@ -0,0 +1,92 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include <Timezone.h>
#define JULY1970 15634800
TimeChangeRule TC_GMT = {"GMT", Last, Sun, Jan, 0, 0};
TimeChangeRule TC_WET = {"WET", Last, Sun, Oct, 2, 0};
TimeChangeRule TC_WEST = {"WEST", Last, Sun, Mar, 1, 60};
TimeChangeRule TC_CET = {"CET", Last, Sun, Oct, 3, 60};
TimeChangeRule TC_CEST = {"CEST", Last, Sun, Mar, 2, 120};
TimeChangeRule TC_EET = {"EET", Last, Sun, Oct, 4, 120};
TimeChangeRule TC_EEST = {"EEST", Last, Sun, Mar, 3, 180};
Timezone GMT = Timezone(TC_GMT);
Timezone WesterEuropean = Timezone(TC_WET, TC_WEST);
Timezone CentralEuropean = Timezone(TC_CET, TC_CEST);
Timezone EasternEuropean = Timezone(TC_EET, TC_EEST);
Timezone* resolveTimezone(char* name) {
if(strncmp_P(name, PSTR("Europe/"), 7) == 0) {
if(strncmp_P(name+7, PSTR("Amsterdam"), 9) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Athens"), 6) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Belfast"), 7) == 0)
return &WesterEuropean;
if(strncmp_P(name+7, PSTR("Berlin"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Bratislava"), 10) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Brussels"), 8) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Bucharest"), 9) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Budapest"), 8) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Copenhagen"), 10) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Dublin"), 6) == 0)
return &WesterEuropean;
if(strncmp_P(name+7, PSTR("Helsinki"), 8) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Lisbon"), 6) == 0)
return &WesterEuropean;
if(strncmp_P(name+7, PSTR("Ljubljana"), 9) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("London"), 6) == 0)
return &WesterEuropean;
if(strncmp_P(name+7, PSTR("Luxembourg"), 10) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Madrid"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Malta"), 5) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Nicosia"), 7) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Oslo"), 4) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Paris"), 5) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Podgorica"), 9) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Prague"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Riga"), 4) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Rome"), 4) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Sofia"), 5) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Stockholm"), 9) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Tallinn"), 7) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Vienna"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Vilnius"), 7) == 0)
return &EasternEuropean;
if(strncmp_P(name+7, PSTR("Warsaw"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Zagreb"), 6) == 0)
return &CentralEuropean;
if(strncmp_P(name+7, PSTR("Zurich"), 6) == 0)
return &CentralEuropean;
}
return &GMT;
}

View File

@@ -0,0 +1,19 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _HEXUTILS_H
#define _HEXUTILS_H
#include <stdint.h>
#include "Arduino.h"
String toHex(uint8_t* in);
String toHex(uint8_t* in, uint16_t size);
void fromHex(uint8_t *out, String in, uint16_t size);
bool stripNonAscii(uint8_t* in, uint16_t size, bool extended = false, bool trim = true);
void debugPrint(uint8_t *buffer, uint16_t start, uint16_t length, Print* debugger);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "hexutils.h"
String toHex(uint8_t* in) {
return toHex(in, sizeof(in)*2);
}
String toHex(uint8_t* in, uint16_t size) {
String hex;
for(int i = 0; i < size; i++) {
if(in[i] < 0x10) {
hex += '0';
}
hex += String(in[i], HEX);
}
hex.toUpperCase();
return hex;
}
void fromHex(uint8_t *out, String in, uint16_t size) {
for(int i = 0; i < size*2; i += 2) {
out[i/2] = strtol(in.substring(i, i+2).c_str(), 0, 16);
}
}
bool stripNonAscii(uint8_t* in, uint16_t size, bool extended, bool trim) {
bool ret = false;
for(uint16_t i = 0; i < size; i++) {
if(in[i] == 0) { // Clear the rest with null-terminator
memset(in+i, 0, size-i);
break;
}
if(extended && (in[i] < 32 || in[i] == 127 || in[i] == 129 || in[i] == 141 || in[i] == 143 || in[i] == 144 || in[i] == 157 || in[i] == 160)) {
memset(in+i, ' ', 1);
ret = true;
} else if(!extended && (in[i] < 32 || in[i] > 126)) {
memset(in+i, ' ', 1);
ret = true;
}
}
if(trim) {
// Strip leading spaces
while(in[0] == ' ') {
for(uint16_t i = 0; i < size; i++) {
in[i] = in[i+1];
}
}
// Strip trailing spaces
for(int i = size-1; i > 0; i--) {
if(in[i] == ' ' || in[i] == 0) {
memset(in+i, 0, 1);
} else {
break;
}
}
}
memset(in+size-1, 0, 1); // Make sure the last character is null-terminator
return ret;
}
void debugPrint(uint8_t *buffer, uint16_t start, uint16_t length, Print* debugger) {
for (uint16_t i = start; i < start + length; i++) {
if (buffer[i] < 0x10)
debugger->print(F("0"));
debugger->print(buffer[i], HEX);
debugger->print(F(" "));
if ((i - start + 1) % 16 == 0)
debugger->println(F(""));
else if ((i - start + 1) % 4 == 0)
debugger->print(F(" "));
yield(); // Let other get some resources too
}
debugger->println(F(""));
}

View File

@@ -0,0 +1,115 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _AMSDATA_H
#define _AMSDATA_H
#include "Arduino.h"
#include <Timezone.h>
#include "OBIScodes.h"
enum AmsType {
AmsTypeAutodetect = 0x00,
AmsTypeAidon = 0x01,
AmsTypeKaifa = 0x02,
AmsTypeKamstrup = 0x03,
AmsTypeIskra = 0x08,
AmsTypeLandisGyr = 0x09,
AmsTypeSagemcom = 0x0A,
AmsTypeCustom = 0x88,
AmsTypeUnknown = 0xFF
};
class AmsData {
public:
AmsData();
void apply(AmsData& other);
void apply(const OBIS_code_t obis, double value);
uint64_t getLastUpdateMillis();
time_t getPackageTimestamp();
uint8_t getListType();
String getListId();
String getMeterId();
uint8_t getMeterType();
String getMeterModel();
time_t getMeterTimestamp();
uint32_t getActiveImportPower();
uint32_t getReactiveImportPower();
uint32_t getActiveExportPower();
uint32_t getReactiveExportPower();
float getL1Voltage();
float getL2Voltage();
float getL3Voltage();
float getL1Current();
float getL2Current();
float getL3Current();
float getPowerFactor();
float getL1PowerFactor();
float getL2PowerFactor();
float getL3PowerFactor();
uint32_t getL1ActiveImportPower();
uint32_t getL2ActiveImportPower();
uint32_t getL3ActiveImportPower();
uint32_t getL1ActiveExportPower();
uint32_t getL2ActiveExportPower();
uint32_t getL3ActiveExportPower();
double getL1ActiveImportCounter();
double getL2ActiveImportCounter();
double getL3ActiveImportCounter();
double getL1ActiveExportCounter();
double getL2ActiveExportCounter();
double getL3ActiveExportCounter();
double getActiveImportCounter();
double getReactiveImportCounter();
double getActiveExportCounter();
double getReactiveExportCounter();
bool isThreePhase();
bool isTwoPhase();
bool isCounterEstimated();
bool isL2currentMissing();
int8_t getLastError();
void setLastError(int8_t);
protected:
uint64_t lastUpdateMillis = 0;
uint64_t lastList2 = 0;
uint8_t listType = 0, meterType = AmsTypeUnknown;
time_t packageTimestamp = 0;
String listId = "", meterId = "", meterModel = "";
time_t meterTimestamp = 0;
uint32_t activeImportPower = 0, reactiveImportPower = 0, activeExportPower = 0, reactiveExportPower = 0;
float l1voltage = 0, l2voltage = 0, l3voltage = 0, l1current = 0, l2current = 0, l3current = 0;
uint32_t l1activeImportPower = 0, l2activeImportPower = 0, l3activeImportPower = 0;
uint32_t l1activeExportPower = 0, l2activeExportPower = 0, l3activeExportPower = 0;
double l1activeImportCounter = 0, l2activeImportCounter = 0, l3activeImportCounter = 0;
double l1activeExportCounter = 0, l2activeExportCounter = 0, l3activeExportCounter = 0;
float powerFactor = 0, l1PowerFactor = 0, l2PowerFactor = 0, l3PowerFactor = 0;
double activeImportCounter = 0, reactiveImportCounter = 0, activeExportCounter = 0, reactiveExportCounter = 0;
double lastKnownCounter = 0;
bool threePhase = false, twoPhase = false, counterEstimated = false, l2currentMissing = false;;
int8_t lastError = 0x00;
uint8_t lastErrorCount = 0;
};
#endif

View File

@@ -0,0 +1,93 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _OBISCODES_H
#define _OBISCODES_H
#include "lwip/def.h"
#define OBIS_MEDIUM_ABSTRACT 0
#define OBIS_MEDIUM_ELECTRICITY 1
#define OBIS_CHAN_0 0
#define OBIS_CHAN_1 1
#define OBIS_RANGE_NA 0xFF
struct OBIS_head_t {
uint8_t medium;
uint8_t channel;
} __attribute__((packed));
struct OBIS_code_t {
uint8_t sensor;
uint8_t gr;
uint8_t tariff;
} __attribute__((packed));
struct OBIS_t {
OBIS_head_t head;
OBIS_code_t code;
uint8_t range;
} __attribute__((packed));
const OBIS_code_t OBIS_NULL PROGMEM = { 0, 0, 0 };
const OBIS_code_t OBIS_FIRMWARE_VERSION PROGMEM = { 0, 2, 0 };
const OBIS_code_t OBIS_VERSION PROGMEM = { 0, 2, 129 };
const OBIS_code_t OBIS_METER_MODEL PROGMEM = { 96, 1, 1 };
const OBIS_code_t OBIS_METER_MODEL_2 PROGMEM = { 96, 1, 7 };
const OBIS_code_t OBIS_METER_ID PROGMEM = { 96, 1, 0 };
const OBIS_code_t OBIS_METER_ID_2 PROGMEM = { 0, 0, 5 };
const OBIS_code_t OBIS_METER_TIMESTAMP PROGMEM = { 1, 0, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT PROGMEM = { 1, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_COUNT PROGMEM = { 1, 8, 0 };
const OBIS_code_t OBIS_ACTIVE_EXPORT PROGMEM = { 2, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_EXPORT_COUNT PROGMEM = { 2, 8, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT PROGMEM = { 3, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_COUNT PROGMEM = { 3, 8, 0 };
const OBIS_code_t OBIS_REACTIVE_EXPORT PROGMEM = { 4, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_EXPORT_COUNT PROGMEM = { 4, 8, 0 };
const OBIS_code_t OBIS_POWER_FACTOR PROGMEM = { 13, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_L1 PROGMEM = { 21, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_EXPORT_L1 PROGMEM = { 22, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_L1 PROGMEM = { 23, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_EXPORT_L1 PROGMEM = { 24, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_COUNT_L1 PROGMEM ={ 21, 8, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_COUNT_L1 PROGMEM ={ 22, 8, 0 };
const OBIS_code_t OBIS_CURRENT_L1 PROGMEM = { 31, 7, 0 };
const OBIS_code_t OBIS_VOLTAGE_L1 PROGMEM = { 32, 7, 0 };
const OBIS_code_t OBIS_POWER_FACTOR_L1 PROGMEM = { 33, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_L2 PROGMEM = { 41, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_EXPORT_L2 PROGMEM = { 42, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_L2 PROGMEM = { 43, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_EXPORT_L2 PROGMEM = { 44, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_COUNT_L2 PROGMEM ={ 41, 8, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_COUNT_L2 PROGMEM ={ 42, 8, 0 };
const OBIS_code_t OBIS_CURRENT_L2 PROGMEM = { 51, 7, 0 };
const OBIS_code_t OBIS_VOLTAGE_L2 PROGMEM = { 52, 7, 0 };
const OBIS_code_t OBIS_POWER_FACTOR_L2 PROGMEM = { 53, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_L3 PROGMEM = { 61, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_EXPORT_L3 PROGMEM = { 62, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_L3 PROGMEM = { 63, 7, 0 };
const OBIS_code_t OBIS_REACTIVE_EXPORT_L3 PROGMEM = { 64, 7, 0 };
const OBIS_code_t OBIS_ACTIVE_IMPORT_COUNT_L3 PROGMEM ={ 61, 8, 0 };
const OBIS_code_t OBIS_REACTIVE_IMPORT_COUNT_L3 PROGMEM ={ 62, 8, 0 };
const OBIS_code_t OBIS_CURRENT_L3 PROGMEM = { 71, 7, 0 };
const OBIS_code_t OBIS_VOLTAGE_L3 PROGMEM = { 72, 7, 0 };
const OBIS_code_t OBIS_POWER_FACTOR_L3 PROGMEM = { 73, 7, 0 };
#endif

447
lib/AmsData/src/AmsData.cpp Normal file
View File

@@ -0,0 +1,447 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "AmsData.h"
AmsData::AmsData() {}
void AmsData::apply(AmsData& other) {
if(other.getListType() < 3) {
unsigned long ms = this->lastUpdateMillis > other.getLastUpdateMillis() ? 0 : other.getLastUpdateMillis() - this->lastUpdateMillis;
if(ms > 0) {
if(other.getActiveImportPower() > 0) {
uint32_t power = (activeImportPower + other.getActiveImportPower()) / 2;
float add = power * (((float) ms) / 3600000.0);
activeImportCounter += add / 1000.0;
//Serial.printf("%dW, %dms, %.6fkWh added\n", other.getActiveImportPower(), ms, add);
}
if(other.getListType() > 1) {
ms = this->lastList2 > other.getLastUpdateMillis() ? 0 : other.getLastUpdateMillis() - this->lastList2;
if(other.getActiveExportPower() > 0) {
uint32_t power = (activeExportPower + other.getActiveExportPower()) / 2;
float add = power * (((float) ms) / 3600000.0);
activeExportCounter += add / 1000.0;
}
if(other.getReactiveImportPower() > 0) {
uint32_t power = (reactiveImportPower + other.getReactiveImportPower()) / 2;
float add = power * (((float) ms) / 3600000.0);
reactiveImportCounter += add / 1000.0;
}
if(other.getReactiveExportPower() > 0) {
uint32_t power = (reactiveExportPower + other.getReactiveExportPower()) / 2;
float add = power * (((float) ms) / 3600000.0);
reactiveExportCounter += add / 1000.0;
}
}
counterEstimated = true;
}
}
this->lastUpdateMillis = other.getLastUpdateMillis();
if(other.getListType() > 1) {
this->lastList2 = this->lastUpdateMillis;
}
this->packageTimestamp = other.getPackageTimestamp();
if(other.getListType() > this->listType)
this->listType = other.getListType();
switch(other.getListType()) {
case 4:
this->powerFactor = other.getPowerFactor();
this->l1PowerFactor = other.getL1PowerFactor();
this->l2PowerFactor = other.getL2PowerFactor();
this->l3PowerFactor = other.getL3PowerFactor();
this->l1activeImportPower = other.getL1ActiveImportPower();
this->l2activeImportPower = other.getL2ActiveImportPower();
this->l3activeImportPower = other.getL3ActiveImportPower();
this->l1activeExportPower = other.getL1ActiveExportPower();
this->l2activeExportPower = other.getL2ActiveExportPower();
this->l3activeExportPower = other.getL3ActiveExportPower();
this->l1activeImportCounter = other.getL1ActiveImportCounter();
this->l2activeImportCounter = other.getL2ActiveImportCounter();
this->l3activeImportCounter = other.getL3ActiveImportCounter();
this->l1activeExportCounter = other.getL1ActiveExportCounter();
this->l2activeExportCounter = other.getL2ActiveExportCounter();
this->l3activeExportCounter = other.getL3ActiveExportCounter();
case 3:
this->meterTimestamp = other.getMeterTimestamp();
// Aidon tends to sometime send the same counter as last hour by accident
if(meterType == AmsTypeAidon && counterEstimated && lastKnownCounter == other.getActiveImportCounter()-other.getActiveExportCounter()) {
double diff = activeImportCounter - activeExportCounter - lastKnownCounter;
if(diff < 1.0) { // In case a very low value have been calculated, use the new values
this->activeImportCounter = other.getActiveImportCounter();
this->activeExportCounter = other.getActiveExportCounter();
this->reactiveImportCounter = other.getReactiveImportCounter();
this->reactiveExportCounter = other.getReactiveExportCounter();
this->lastKnownCounter = activeImportCounter - activeExportCounter;
}
} else {
this->activeImportCounter = other.getActiveImportCounter();
this->activeExportCounter = other.getActiveExportCounter();
this->reactiveImportCounter = other.getReactiveImportCounter();
this->reactiveExportCounter = other.getReactiveExportCounter();
this->lastKnownCounter = activeImportCounter - activeExportCounter;
}
this->counterEstimated = false;
case 2:
this->listId = other.getListId();
this->meterId = other.getMeterId();
this->meterType = other.getMeterType();
this->meterModel = other.getMeterModel();
this->reactiveImportPower = other.getReactiveImportPower();
this->reactiveExportPower = other.getReactiveExportPower();
this->l1current = other.getL1Current();
this->l2current = other.getL2Current();
this->l2currentMissing = other.isL2currentMissing();
this->l3current = other.getL3Current();
this->l1voltage = other.getL1Voltage();
this->l2voltage = other.getL2Voltage();
this->l3voltage = other.getL3Voltage();
this->threePhase = other.isThreePhase();
this->twoPhase = other.isTwoPhase();
}
// Moved outside switch to handle meters alternating between sending active and accumulated values
if(other.getListType() == 1 || (other.getActiveImportPower() > 0 || other.getActiveExportPower() > 0))
this->activeImportPower = other.getActiveImportPower();
if(other.getListType() == 2 || (other.getActiveImportPower() > 0 || other.getActiveExportPower() > 0))
this->activeExportPower = other.getActiveExportPower();
}
void AmsData::apply(OBIS_code_t obis, double value) {
if(obis.sensor == 0 && obis.gr == 0 && obis.tariff == 0) {
meterType = value;
}
if(obis.gr == 1) {
if(obis.sensor == 96) {
if(obis.tariff == 0) {
meterId = String((long) value, 10);
return;
} else if(obis.tariff == 1) {
return;
}
}
}
if(obis.tariff != 0) {
Serial.println("Tariff not implemented");
return;
}
if(obis.gr == 7) { // Instant values
switch(obis.sensor) {
case 1:
activeImportPower = value;
listType = max(listType, (uint8_t) 2);
break;
case 2:
activeExportPower = value;
listType = max(listType, (uint8_t) 2);
break;
case 3:
reactiveImportPower = value;
listType = max(listType, (uint8_t) 2);
break;
case 4:
reactiveExportPower = value;
listType = max(listType, (uint8_t) 2);
break;
case 13:
powerFactor = value;
listType = max(listType, (uint8_t) 4);
break;
case 21:
l1activeImportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 22:
l1activeExportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 31:
l1current = value;
listType = max(listType, (uint8_t) 2);
break;
case 32:
l1voltage = value;
listType = max(listType, (uint8_t) 2);
break;
case 33:
l1PowerFactor = value;
listType = max(listType, (uint8_t) 4);
break;
case 41:
l2activeImportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 42:
l2activeExportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 51:
l2current = value;
listType = max(listType, (uint8_t) 2);
break;
case 52:
l2voltage = value;
listType = max(listType, (uint8_t) 2);
break;
case 53:
l2PowerFactor = value;
listType = max(listType, (uint8_t) 4);
break;
case 61:
l3activeImportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 62:
l3activeExportPower = value;
listType = max(listType, (uint8_t) 4);
break;
case 71:
l3current = value;
listType = max(listType, (uint8_t) 2);
break;
case 72:
l3voltage = value;
listType = max(listType, (uint8_t) 2);
break;
case 73:
l3PowerFactor = value;
listType = max(listType, (uint8_t) 4);
break;
}
} else if(obis.gr == 8) { // Accumulated values
switch(obis.sensor) {
case 1:
activeImportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
case 2:
activeExportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
case 3:
reactiveImportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
case 4:
reactiveExportCounter = value;
listType = max(listType, (uint8_t) 3);
break;
case 21:
l1activeImportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
case 22:
l1activeExportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
case 41:
l2activeImportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
case 42:
l2activeExportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
case 61:
l3activeImportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
case 62:
l3activeExportCounter = value;
listType = max(listType, (uint8_t) 4);
break;
}
}
if(listType > 0)
lastUpdateMillis = millis();
threePhase = l1voltage > 0 && l2voltage > 0 && l3voltage > 0;
if(!threePhase)
twoPhase = (l1voltage > 0 && l2voltage > 0) || (l2voltage > 0 && l3voltage > 0) || (l3voltage > 0 && l1voltage > 0);
}
uint64_t AmsData::getLastUpdateMillis() {
return this->lastUpdateMillis;
}
time_t AmsData::getPackageTimestamp() {
return this->packageTimestamp;
}
uint8_t AmsData::getListType() {
return this->listType;
}
String AmsData::getListId() {
return this->listId;
}
String AmsData::getMeterId() {
return this->meterId;
}
uint8_t AmsData::getMeterType() {
return this->meterType;
}
String AmsData::getMeterModel() {
return this->meterModel;
}
time_t AmsData::getMeterTimestamp() {
return this->meterTimestamp;
}
uint32_t AmsData::getActiveImportPower() {
return this->activeImportPower;
}
uint32_t AmsData::getReactiveImportPower() {
return this->reactiveImportPower;
}
uint32_t AmsData::getActiveExportPower() {
return this->activeExportPower;
}
uint32_t AmsData::getReactiveExportPower() {
return this->reactiveExportPower;
}
float AmsData::getL1Voltage() {
return this->l1voltage;
}
float AmsData::getL2Voltage() {
return this->l2voltage;
}
float AmsData::getL3Voltage() {
return this->l3voltage;
}
float AmsData::getL1Current() {
return this->l1current;
}
float AmsData::getL2Current() {
return this->l2current;
}
float AmsData::getL3Current() {
return this->l3current;
}
float AmsData::getPowerFactor() {
return this->powerFactor;
}
float AmsData::getL1PowerFactor() {
return this->l1PowerFactor;
}
float AmsData::getL2PowerFactor() {
return this->l2PowerFactor;
}
float AmsData::getL3PowerFactor() {
return this->l3PowerFactor;
}
uint32_t AmsData::getL1ActiveImportPower() {
return this->l1activeImportPower;
}
uint32_t AmsData::getL2ActiveImportPower() {
return this->l2activeImportPower;
}
uint32_t AmsData::getL3ActiveImportPower() {
return this->l3activeImportPower;
}
uint32_t AmsData::getL1ActiveExportPower() {
return this->l1activeExportPower;
}
uint32_t AmsData::getL2ActiveExportPower() {
return this->l2activeExportPower;
}
uint32_t AmsData::getL3ActiveExportPower() {
return this->l3activeExportPower;
}
double AmsData::getL1ActiveImportCounter() {
return this->l1activeImportCounter;
}
double AmsData::getL2ActiveImportCounter() {
return this->l2activeImportCounter;
}
double AmsData::getL3ActiveImportCounter() {
return this->l3activeImportCounter;
}
double AmsData::getL1ActiveExportCounter() {
return this->l1activeExportCounter;
}
double AmsData::getL2ActiveExportCounter() {
return this->l2activeExportCounter;
}
double AmsData::getL3ActiveExportCounter() {
return this->l3activeExportCounter;
}
double AmsData::getActiveImportCounter() {
return this->activeImportCounter;
}
double AmsData::getReactiveImportCounter() {
return this->reactiveImportCounter;
}
double AmsData::getActiveExportCounter() {
return this->activeExportCounter;
}
double AmsData::getReactiveExportCounter() {
return this->reactiveExportCounter;
}
bool AmsData::isThreePhase() {
return this->threePhase;
}
bool AmsData::isTwoPhase() {
return this->twoPhase;
}
bool AmsData::isCounterEstimated() {
return this->counterEstimated;
}
bool AmsData::isL2currentMissing() {
return this->l2currentMissing;
}
int8_t AmsData::getLastError() {
return lastErrorCount > 2 ? lastError : 0;
}
void AmsData::setLastError(int8_t lastError) {
this->lastError = lastError;
if(lastError == 0) {
lastErrorCount = 0;
} else {
lastErrorCount++;
}
}

View File

@@ -0,0 +1,116 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _AMSDATASTORAGE_H
#define _AMSDATASTORAGE_H
#include "Arduino.h"
#include "AmsData.h"
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#include "Timezone.h"
struct DayDataPoints5 {
uint8_t version;
uint16_t hImport[24];
time_t lastMeterReadTime;
uint32_t activeImport;
uint32_t activeExport;
uint16_t hExport[24];
uint8_t accuracy;
};
struct MonthDataPoints6 {
uint8_t version;
uint16_t dImport[31];
time_t lastMeterReadTime;
uint32_t activeImport;
uint32_t activeExport;
uint16_t dExport[31];
uint8_t accuracy;
};
struct DayDataPoints {
uint8_t version;
uint16_t hImport[24];
time_t lastMeterReadTime;
uint64_t activeImport;
uint64_t activeExport;
uint16_t hExport[24];
uint8_t accuracy;
};
struct MonthDataPoints {
uint8_t version;
uint16_t dImport[31];
time_t lastMeterReadTime;
uint64_t activeImport;
uint64_t activeExport;
uint16_t dExport[31];
uint8_t accuracy;
};
class AmsDataStorage {
public:
#if defined(AMS_REMOTE_DEBUG)
AmsDataStorage(RemoteDebug*);
#else
AmsDataStorage(Stream*);
#endif
void setTimezone(Timezone*);
bool update(AmsData* data, time_t now);
uint32_t getHourImport(uint8_t);
uint32_t getHourExport(uint8_t);
uint32_t getDayImport(uint8_t);
uint32_t getDayExport(uint8_t);
bool load();
bool save();
DayDataPoints getDayData();
bool setDayData(DayDataPoints&);
MonthDataPoints getMonthData();
bool setMonthData(MonthDataPoints&);
uint8_t getDayAccuracy();
void setDayAccuracy(uint8_t);
uint8_t getMonthAccuracy();
void setMonthAccuracy(uint8_t);
bool isHappy(time_t now);
bool isDayHappy(time_t now);
bool isMonthHappy(time_t now);
double getEstimatedImportCounter();
void setHourImport(uint8_t, uint32_t);
void setHourExport(uint8_t, uint32_t);
void setDayImport(uint8_t, uint32_t);
void setDayExport(uint8_t, uint32_t);
private:
Timezone* tz;
DayDataPoints day = {
0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10
};
MonthDataPoints month = {
0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10
};
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Stream* debugger;
#endif
};
#endif

View File

@@ -0,0 +1,700 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "AmsDataStorage.h"
#include <lwip/apps/sntp.h>
#include "LittleFS.h"
#include "AmsStorage.h"
#include "FirmwareVersion.h"
#if defined(AMS_REMOTE_DEBUG)
AmsDataStorage::AmsDataStorage(RemoteDebug* debugger) {
#else
AmsDataStorage::AmsDataStorage(Stream* debugger) {
#endif
day.version = 6;
day.accuracy = 1;
month.version = 7;
month.accuracy = 1;
this->debugger = debugger;
}
void AmsDataStorage::setTimezone(Timezone* tz) {
this->tz = tz;
}
bool AmsDataStorage::update(AmsData* data, time_t now) {
if(isHappy(now)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Happy, not updating\n"));
return false;
}
if(tz == NULL) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("No timezone, not updating\n"));
return false;
}
if(now < FirmwareVersion::BuildEpoch) {
if(data->getMeterTimestamp() > FirmwareVersion::BuildEpoch) {
now = data->getMeterTimestamp();
} else if(data->getPackageTimestamp() > FirmwareVersion::BuildEpoch) {
now = data->getPackageTimestamp();
}
}
if(now < FirmwareVersion::BuildEpoch) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Before build time, not updating\n"));
return false;
}
tmElements_t utc, ltz, utcYesterday, ltzYesterDay;
breakTime(now, utc);
breakTime(tz->toLocal(now), ltz);
breakTime(now-3600, utcYesterday);
breakTime(tz->toLocal(now-3600), ltzYesterDay);
uint64_t importCounter = data->getActiveImportCounter() * 1000;
uint64_t exportCounter = data->getActiveExportCounter() * 1000;
// Clear hours between last update and now
if(!isDayHappy(now) && day.lastMeterReadTime > now) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Day was updated in the future, resetting\n"));
day.activeImport = importCounter;
day.activeExport = exportCounter;
day.lastMeterReadTime = now;
} else if(importCounter > 0 && day.activeImport == 0) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Initializing day data\n"));
day.activeImport = importCounter;
day.activeExport = exportCounter;
day.lastMeterReadTime = now;
for(int i = 0; i<24; i++) {
setHourImport(i, 0);
setHourExport(i, 0);
}
} else if(now - day.lastMeterReadTime > 86400) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Day was updated to long ago, clearing\n"));
day.activeImport = importCounter;
day.activeExport = exportCounter;
day.lastMeterReadTime = now;
for(int i = 0; i<24; i++) {
setHourImport(i, 0);
setHourExport(i, 0);
}
} else {
tmElements_t last;
breakTime(day.lastMeterReadTime, last);
uint8_t endHour = utc.Hour;
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Clearing hours from %d to %d\n"), last.Hour, endHour);
if(last.Hour > utc.Hour){
for(int i = 0; i < utc.Hour; i++) {
setHourImport(i, 0);
setHourExport(i, 0);
}
endHour = 24;
}
for(int i = last.Hour; i < endHour; i++) {
setHourImport(i, 0);
setHourExport(i, 0);
}
}
// Clear days between last update and now
if(!isMonthHappy(now) && month.lastMeterReadTime > now) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Month was updated in the future, resetting\n"));
month.activeImport = importCounter;
month.activeExport = exportCounter;
month.lastMeterReadTime = now;
} else if(importCounter > 0 && month.activeImport == 0) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Initializing month data\n"));
month.activeImport = importCounter;
month.activeExport = exportCounter;
month.lastMeterReadTime = now;
for(int i = 1; i<=31; i++) {
setDayImport(i, 0);
setDayExport(i, 0);
}
} else if(now - month.lastMeterReadTime > 2682000) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Month was updated to long ago, clearing\n"));
month.activeImport = importCounter;
month.activeExport = exportCounter;
month.lastMeterReadTime = now;
for(int i = 1; i<=31; i++) {
setDayImport(i, 0);
setDayExport(i, 0);
}
} else {
tmElements_t last;
breakTime(tz->toLocal(month.lastMeterReadTime), last);
uint8_t endDay = ltz.Day;
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Clearing days from %d to %d\n"), last.Day, endDay);
if(last.Day > ltz.Day) {
for(int i = 1; i < ltz.Day; i++) {
setDayImport(i, 0);
setDayExport(i, 0);
}
endDay = 31;
}
for(int i = last.Day; i < endDay; i++) {
setDayImport(i, 0);
setDayExport(i, 0);
}
}
if(data->getListType() < 3) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Type %d, not updating\n"), data->getListType());
return false;
}
bool ret = false;
// Update day plot
if(!isDayHappy(now)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Day is not happy\n"));
if(day.activeImport > importCounter || day.activeExport > exportCounter) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - reset\n"));
day.activeImport = importCounter;
day.activeExport = exportCounter;
day.lastMeterReadTime = now;
setHourImport(utcYesterday.Hour, 0);
setHourExport(utcYesterday.Hour, 0);
} else if(now - day.lastMeterReadTime < 4000) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - normal\n"));
uint32_t imp = importCounter - day.activeImport;
uint32_t exp = exportCounter - day.activeExport;
setHourImport(utcYesterday.Hour, imp);
setHourExport(utcYesterday.Hour, exp);
day.activeImport = importCounter;
day.activeExport = exportCounter;
day.lastMeterReadTime = now;
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - average\n"));
float mins = (now - day.lastMeterReadTime) / 60.0;
uint32_t im = importCounter - day.activeImport;
uint32_t ex = exportCounter - day.activeExport;
float ipm = im / mins;
float epm = ex / mins;
tmElements_t last;
breakTime(day.lastMeterReadTime, last);
day.lastMeterReadTime = day.lastMeterReadTime - (last.Minute * 60) - last.Second;
time_t stopAt = now - (utc.Minute * 60) - utc.Second;
while(day.lastMeterReadTime < stopAt) {
time_t cur = min(day.lastMeterReadTime + 3600, stopAt);
uint8_t minutes = round((cur - day.lastMeterReadTime) / 60.0);
if(minutes < 1) break;
breakTime(day.lastMeterReadTime, last);
float imp = (ipm * minutes);
float exp = (epm * minutes);
setHourImport(last.Hour, imp);
setHourExport(last.Hour, exp);
day.activeImport += imp;
day.activeExport += exp;
day.lastMeterReadTime = cur;
}
}
ret = true;
}
// Update month plot
if(ltz.Hour == 0 && !isMonthHappy(now)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("Month is not happy\n"));
if(month.activeImport > importCounter || month.activeExport > exportCounter) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - reset\n"));
month.activeImport = importCounter;
month.activeExport = exportCounter;
month.lastMeterReadTime = now;
setDayImport(ltzYesterDay.Day, 0);
setDayExport(ltzYesterDay.Day, 0);
} else if(now - month.lastMeterReadTime < 90100 && now - month.lastMeterReadTime > 82700) { // DST days are 23h (82800s) and 25h (90000)
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - normal\n"));
uint32_t imp = importCounter - month.activeImport;
uint32_t exp = exportCounter - month.activeExport;
setDayImport(ltzYesterDay.Day, imp);
setDayExport(ltzYesterDay.Day, exp);
month.activeImport = importCounter;
month.activeExport = exportCounter;
month.lastMeterReadTime = now;
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR(" - average\n"));
// Make sure last month read is at midnight
tmElements_t last;
breakTime(tz->toLocal(month.lastMeterReadTime), last);
month.lastMeterReadTime = month.lastMeterReadTime - (last.Hour * 3600) - (last.Minute * 60) - last.Second;
float hrs = (now - month.lastMeterReadTime) / 3600.0;
uint32_t im = importCounter - month.activeImport;
uint32_t ex = exportCounter - month.activeExport;
float iph = im / hrs;
float eph = ex / hrs;
time_t stopAt = now - (ltz.Hour * 3600) - (ltz.Minute * 60) - ltz.Second;
while(month.lastMeterReadTime < stopAt) {
time_t cur = min(month.lastMeterReadTime + 86400, stopAt);
uint8_t hours = round((cur - month.lastMeterReadTime) / 3600.0);
breakTime(tz->toLocal(month.lastMeterReadTime), last);
float imp = (iph * hours);
float exp = (eph * hours);
setDayImport(last.Day, imp);
setDayExport(last.Day, exp);
month.activeImport += imp;
month.activeExport += exp;
month.lastMeterReadTime = cur;
}
}
ret = true;
}
return ret;
}
void AmsDataStorage::setHourImport(uint8_t hour, uint32_t val) {
if(hour < 0 || hour > 24) return;
uint8_t accuracy = day.accuracy;
uint32_t update = val / pow(10, accuracy);
while(update > UINT16_MAX) {
accuracy++;
update = val / pow(10, accuracy);
}
if(accuracy != day.accuracy) {
setDayAccuracy(accuracy);
}
day.hImport[hour] = update;
uint32_t max = 0;
for(uint8_t i = 0; i < 24; i++) {
if(day.hImport[i] > max)
max = day.hImport[i];
if(day.hExport[i] > max)
max = day.hExport[i];
}
while(max < UINT16_MAX/10 && accuracy > 0) {
accuracy--;
max = max*10;
}
if(accuracy != day.accuracy) {
setDayAccuracy(accuracy);
}
}
uint32_t AmsDataStorage::getHourImport(uint8_t hour) {
if(hour < 0 || hour > 24) return 0;
return day.hImport[hour] * pow(10, day.accuracy);
}
void AmsDataStorage::setHourExport(uint8_t hour, uint32_t val) {
if(hour < 0 || hour > 24) return;
uint8_t accuracy = day.accuracy;
uint32_t update = val / pow(10, accuracy);
while(update > UINT16_MAX) {
accuracy++;
update = val / pow(10, accuracy);
}
if(accuracy != day.accuracy) {
setDayAccuracy(accuracy);
}
day.hExport[hour] = update;
uint32_t max = 0;
for(uint8_t i = 0; i < 24; i++) {
if(day.hImport[i] > max)
max = day.hImport[i];
if(day.hExport[i] > max)
max = day.hExport[i];
}
while(max < UINT16_MAX/10 && accuracy > 0) {
accuracy--;
max = max*10;
}
if(accuracy != day.accuracy) {
setDayAccuracy(accuracy);
}
}
uint32_t AmsDataStorage::getHourExport(uint8_t hour) {
if(hour < 0 || hour > 24) return 0;
return day.hExport[hour] * pow(10, day.accuracy);
}
void AmsDataStorage::setDayImport(uint8_t day, uint32_t val) {
if(day < 1 || day > 31) return;
uint8_t accuracy = month.accuracy;
uint32_t update = val / pow(10, accuracy);
while(update > UINT16_MAX) {
accuracy++;
update = val / pow(10, accuracy);
}
if(accuracy != month.accuracy) {
setMonthAccuracy(accuracy);
}
month.dImport[day-1] = update;
uint32_t max = 0;
for(uint8_t i = 0; i < 31; i++) {
if(month.dImport[i] > max)
max = month.dImport[i];
if(month.dExport[i] > max)
max = month.dExport[i];
}
while(max < UINT16_MAX/10 && accuracy > 0) {
accuracy--;
max = max*10;
}
if(accuracy != month.accuracy) {
setMonthAccuracy(accuracy);
}
}
uint32_t AmsDataStorage::getDayImport(uint8_t day) {
if(day < 1 || day > 31) return 0;
return (month.dImport[day-1] * pow(10, month.accuracy));
}
void AmsDataStorage::setDayExport(uint8_t day, uint32_t val) {
if(day < 1 || day > 31) return;
uint8_t accuracy = month.accuracy;
uint32_t update = val / pow(10, accuracy);
while(update > UINT16_MAX) {
accuracy++;
update = val / pow(10, accuracy);
}
if(accuracy != month.accuracy) {
setMonthAccuracy(accuracy);
}
month.dExport[day-1] = update;
uint32_t max = 0;
for(uint8_t i = 0; i < 31; i++) {
if(month.dImport[i] > max)
max = month.dImport[i];
if(month.dExport[i] > max)
max = month.dExport[i];
}
while(max < UINT16_MAX/10 && accuracy > 0) {
accuracy--;
max = max*10;
}
if(accuracy != month.accuracy) {
setMonthAccuracy(accuracy);
}
}
uint32_t AmsDataStorage::getDayExport(uint8_t day) {
if(day < 1 || day > 31) return 0;
return (month.dExport[day-1] * pow(10, month.accuracy));
}
bool AmsDataStorage::load() {
if(!LittleFS.begin()) {
return false;
}
bool ret = false;
if(LittleFS.exists(FILE_DAYPLOT)) {
File file = LittleFS.open(FILE_DAYPLOT, "r");
char buf[file.size()];
file.readBytes(buf, file.size());
if(buf[0] > 5) {
DayDataPoints* day = (DayDataPoints*) buf;
ret = setDayData(*day);
} else {
DayDataPoints5* old = (DayDataPoints5*) buf;
DayDataPoints day = { old->version };
day.lastMeterReadTime = old->lastMeterReadTime;
day.activeImport = old->activeImport;
day.activeExport = old->activeExport;
day.accuracy = old->accuracy;
for(uint8_t i = 0; i < 24; i++) {
day.hImport[i] = old->hImport[i];
day.hExport[i] = old->hExport[i];
}
ret = setDayData(day);
}
file.close();
}
if(LittleFS.exists(FILE_MONTHPLOT)) {
File file = LittleFS.open(FILE_MONTHPLOT, "r");
char buf[file.size()];
file.readBytes(buf, file.size());
if(buf[0] > 6) {
MonthDataPoints* month = (MonthDataPoints*) buf;
ret &= setMonthData(*month);
} else {
MonthDataPoints6* old = (MonthDataPoints6*) buf;
MonthDataPoints month = { old->version };
month.lastMeterReadTime = old->lastMeterReadTime;
month.activeImport = old->activeImport;
month.activeExport = old->activeExport;
month.accuracy = old->accuracy;
for(uint8_t i = 0; i < 31; i++) {
month.dImport[i] = old->dImport[i];
month.dExport[i] = old->dExport[i];
}
ret &= setMonthData(month);
}
file.close();
}
return ret;
}
bool AmsDataStorage::save() {
if(!LittleFS.begin()) {
return false;
}
{
File file = LittleFS.open(FILE_DAYPLOT, "w");
char buf[sizeof(day)];
memcpy(buf, &day, sizeof(day));
for(unsigned long i = 0; i < sizeof(day); i++) {
file.write(buf[i]);
}
file.close();
}
{
File file = LittleFS.open(FILE_MONTHPLOT, "w");
char buf[sizeof(month)];
memcpy(buf, &month, sizeof(month));
for(unsigned long i = 0; i < sizeof(month); i++) {
file.write(buf[i]);
}
file.close();
}
return true;
}
DayDataPoints AmsDataStorage::getDayData() {
return day;
}
MonthDataPoints AmsDataStorage::getMonthData() {
return month;
}
bool AmsDataStorage::setDayData(DayDataPoints& day) {
if(day.version == 5 || day.version == 6) {
this->day = day;
this->day.version = 6;
return true;
} else if(day.version == 4) {
this->day = day;
this->day.accuracy = 1;
this->day.version = 6;
return true;
} else if(day.version == 3) {
this->day = day;
for(uint8_t i = 0; i < 24; i++) this->day.hExport[i] = 0;
this->day.accuracy = 1;
this->day.version = 6;
return true;
}
return false;
}
bool AmsDataStorage::setMonthData(MonthDataPoints& month) {
if(month.version == 6 || month.version == 7) {
this->month = month;
this->month.version = 7;
return true;
} else if(month.version == 5) {
this->month = month;
this->month.accuracy = 1;
this->month.version = 7;
return true;
} else if(month.version == 4) {
this->month = month;
for(uint8_t i = 0; i < 31; i++) this->month.dExport[i] = 0;
this->month.accuracy = 1;
this->month.version = 7;
return true;
}
return false;
}
uint8_t AmsDataStorage::getDayAccuracy() {
return day.accuracy;
}
void AmsDataStorage::setDayAccuracy(uint8_t accuracy) {
if(day.accuracy != accuracy) {
double multiplier = pow(10, day.accuracy)/pow(10, accuracy);
for(uint8_t i = 0; i < 24; i++) {
day.hImport[i] = day.hImport[i] * multiplier;
day.hExport[i] = day.hExport[i] * multiplier;
}
day.accuracy = accuracy;
}
}
uint8_t AmsDataStorage::getMonthAccuracy() {
return month.accuracy;
}
void AmsDataStorage::setMonthAccuracy(uint8_t accuracy) {
if(month.accuracy != accuracy) {
double multiplier = pow(10, month.accuracy)/pow(10, accuracy);
for(uint8_t i = 0; i < 31; i++) {
month.dImport[i] = month.dImport[i] * multiplier;
month.dExport[i] = month.dExport[i] * multiplier;
}
month.accuracy = accuracy;
}
month.accuracy = accuracy;
}
bool AmsDataStorage::isHappy(time_t now) {
return isDayHappy(now) && isMonthHappy(now);
}
bool AmsDataStorage::isDayHappy(time_t now) {
if(tz == NULL) {
return false;
}
if(now < FirmwareVersion::BuildEpoch) return false;
if(now < day.lastMeterReadTime) {
return false;
}
// There are cases where the meter reports before the hour. The update method will then receive the meter timestamp as reference, thus there will not be 3600s between.
// Leaving a 100s buffer for these cases
if(now-day.lastMeterReadTime > 3500) {
return false;
}
tmElements_t tm, last;
breakTime(tz->toLocal(now), tm);
breakTime(tz->toLocal(day.lastMeterReadTime), last);
if(tm.Hour != last.Hour) {
return false;
}
return true;
}
bool AmsDataStorage::isMonthHappy(time_t now) {
if(tz == NULL) {
return false;
}
if(now < FirmwareVersion::BuildEpoch) return false;
if(now < month.lastMeterReadTime) {
return false;
}
// 25 hours, because of DST
if(now-month.lastMeterReadTime > 90000) {
return false;
}
tmElements_t tm, last;
breakTime(tz->toLocal(now), tm);
breakTime(tz->toLocal(month.lastMeterReadTime), last);
if(tm.Day != last.Day) {
return false;
}
return true;
}
double AmsDataStorage::getEstimatedImportCounter() {
if(day.lastMeterReadTime == 0) return 0;
time_t now = time(nullptr);
double hours = (now - day.lastMeterReadTime) / 3600.0;
uint64_t total = 0;
for(uint8_t i = 0; i < 24; i++) {
total += getHourImport(i);
}
double perHour = total / 24.0;
return (day.activeImport + (perHour * hours)) / 1000.0;
}

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _COSEM_H
#define _COSEM_H
@@ -8,14 +14,18 @@ enum CosemType {
CosemTypeNull = 0x00,
CosemTypeArray = 0x01,
CosemTypeStructure = 0x02,
CosemTypeBoolean = 0x03,
CosemTypeOctetString = 0x09,
CosemTypeString = 0x0A,
CosemTypeDLongSigned = 0x05,
CosemTypeDLongUnsigned = 0x06,
CosemTypeSigned = 0x0F,
CosemTypeLongSigned = 0x10,
CosemTypeUnsigned = 0x11,
CosemTypeLongUnsigned = 0x12,
CosemTypeLong64Signed = 0x14,
CosemTypeLong64Unsigned = 0x15,
CosemTypeEnum = 0x16,
CosemTypeDateTime = 0x19
};

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _DATAPASERSER_H
#define _DATAPASERSER_H
@@ -10,11 +16,15 @@
#define DATA_TAG_MBUS 0x68
#define DATA_TAG_GBT 0xE0
#define DATA_TAG_GCM 0xDB
#define DATA_TAG_SNRM 0x81
#define DATA_TAG_AARQ 0x60
#define DATA_TAG_AARE 0x61
#define DATA_TAG_RES 0xC4 // Get Response
#define DATA_PARSE_OK 0
#define DATA_PARSE_FAIL -1
#define DATA_PARSE_INCOMPLETE -2
#define DATA_PARSE_BOUNDRY_FLAG_MISSING -3
#define DATA_PARSE_BOUNDARY_FLAG_MISSING -3
#define DATA_PARSE_HEADER_CHECKSUM_ERROR -4
#define DATA_PARSE_FOOTER_CHECKSUM_ERROR -5
#define DATA_PARSE_INTERMEDIATE_SEGMENT -6

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _DATAPASERSERS_H
#define _DATAPASERSERS_H

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _DLMSPARSER_H
#define _DLMSPARSER_H

View File

@@ -0,0 +1,27 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _DSMRPARSER_H
#define _DSMRPARSER_H
#include "Arduino.h"
#include "DataParser.h"
#include "GcmParser.h"
class DSMRParser {
public:
DSMRParser(GCMParser* gcmParser) { this->gcmParser = gcmParser; };
int8_t parse(uint8_t *buf, DataParserContext &ctx, bool verified, Print* debugger);
uint16_t getCrc();
uint16_t getCrcCalc();
private:
uint16_t crc;
uint16_t crc_calc;
GCMParser* gcmParser;
};
#endif

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _GBTPARSER_H
#define _GBTPARSER_H

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _GCMPARSER_H
#define _GCMPARSER_H
@@ -9,16 +15,10 @@
#define GCM_DECRYPT_FAILED -52
#define GCM_ENCRYPTION_KEY_FAILED -53
typedef struct GCMSizeDef {
uint8_t flag;
uint16_t format;
} __attribute__((packed)) GCMSizeDef;
class GCMParser {
public:
GCMParser(uint8_t *encryption_key, uint8_t *authentication_key);
int8_t parse(uint8_t *buf, DataParserContext &ctx);
int8_t parse(uint8_t *buf, DataParserContext &ctx, bool hastag = true);
private:
uint8_t encryption_key[16];
uint8_t authentication_key[16];

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _HDLCPARSER_H
#define _HDLCPARSER_H
@@ -24,6 +30,11 @@ typedef struct HDLC3CtrlHcs {
class HDLCParser {
public:
int8_t parse(uint8_t *buf, DataParserContext &ctx);
private:
uint8_t lastSequenceNumber = 0;
uint16_t pos = 0;
uint8_t *buf = NULL;
};
#endif

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _LLCPARSER_H
#define _LLCPARSER_H

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _MBUSPARSER_H
#define _MBUSPARSER_H

View File

@@ -1,9 +1,16 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _CRC_H
#define _CRC_H
#include "Arduino.h"
#include <stdint.h>
uint16_t crc16(const uint8_t* p, int len);
uint16_t crc16_x25(const uint8_t* p, int len);
#endif

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _NTOHLL_H
#define _NTOHLL_H

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "Cosem.h"
#include "lwip/def.h"
#include <TimeLib.h>
@@ -13,12 +19,10 @@ time_t decodeCosemDateTime(CosemDateTime timestamp) {
tm.Minute = timestamp.minute;
tm.Second = timestamp.second;
//Serial.printf("\nY: %d, M: %d, D: %d, h: %d, m: %d, s: %d, deviation: 0x%2X, status: 0x%1X\n", tm.Year, tm.Month, tm.Day, tm.Hour, tm.Minute, tm.Second, timestamp.deviation, timestamp.status);
time_t time = makeTime(tm);
int16_t deviation = ntohs(timestamp.deviation);
if(deviation >= -720 && deviation <= 720) {
time -= deviation * 60;
time += deviation * 60;
}
return time;
}

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "DlmsParser.h"
#include "Cosem.h"

View File

@@ -0,0 +1,92 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "DsmrParser.h"
#include "crc.h"
#include "hexutils.h"
#include "lwip/def.h"
// verified indicates that this data was encapsulated in something else, so we know this has the correct size etc
int8_t DSMRParser::parse(uint8_t *buf, DataParserContext &ctx, bool verified, Print* debugger) {
uint16_t lenBefore = ctx.length;
uint16_t crcPos = 0;
bool reachedEnd = verified;
uint8_t lastByte = 0x00;
for(uint16_t pos = 0; pos < ctx.length; pos++) {
uint8_t b = *(buf+pos);
if(pos == 0 && b != '/') return DATA_PARSE_BOUNDARY_FLAG_MISSING;
if(pos > 0 && b == '!') crcPos = pos+1;
if(crcPos > 0 && b == 0x0A && lastByte == 0x0D) {
reachedEnd = true;
ctx.length = pos;
break;
}
lastByte = b;
}
if(!reachedEnd) return DATA_PARSE_INCOMPLETE;
buf[ctx.length+1] = '\0';
// If we expect data to be encrypted and it was not previously verified, decrypt content
if(gcmParser != NULL && !verified) {
uint8_t* ptr = (uint8_t*) buf;
while(*ptr != 0x0D && *ptr != 0x0A) ptr++;
while(*ptr == 0x0D || *ptr == 0x0A) ptr++;
uint16_t pos = ptr-buf;
DataParserContext gcmCtx = {
DATA_TAG_GCM,
crcPos - pos - 1,
ctx.timestamp
};
if(debugger != NULL) {
debugger->printf_P(PSTR("DSMR wants to decrypt at position %lu, length: %d, payload:\n"), pos, gcmCtx.length);
debugPrint(ptr, 0, gcmCtx.length, debugger);
}
int8_t gcmRet = gcmParser->parse(ptr, gcmCtx, false);
if(gcmRet < 0) {
if(debugger != NULL) {
debugger->printf_P(PSTR(" - Failed! (%d)\n"), gcmRet);
}
return gcmRet;
} else {
if(debugger != NULL) {
debugger->printf_P(PSTR(" - Success! (%d)\n"), gcmRet);
}
ptr += gcmRet;
for(uint16_t i = 0; i < gcmCtx.length; i++) {
buf[pos++] = ptr[i];
}
ptr = buf + crcPos - 1;
crcPos = pos + 1;
while(*ptr != '\0') {
ctx.length = pos;
buf[pos++] = *(ptr++);
}
while(pos < lenBefore) {
buf[pos++] = '\0';
}
}
} else if(crcPos > 0) {
crc_calc = crc16(buf, crcPos);
crc = 0x0000;
fromHex((uint8_t*) &crc, String((char*) buf+crcPos), 2);
crc = ntohs(crc);
if(crc > 0 && crc != crc_calc) {
if(debugger != NULL) {
debugger->printf_P(PSTR("CRC incorrrect, %04X != %04X at position %lu\n"), crc, crc_calc, crcPos);
}
return DATA_PARSE_FOOTER_CHECKSUM_ERROR;
}
}
return DATA_PARSE_OK;
}
uint16_t DSMRParser::getCrc() {
return crc;
}
uint16_t DSMRParser::getCrcCalc() {
return crc_calc;
}

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "GbtParser.h"
#include "lwip/def.h"
@@ -5,7 +11,7 @@ int8_t GBTParser::parse(uint8_t *d, DataParserContext &ctx) {
GBTHeader* h = (GBTHeader*) (d);
uint16_t sequence = ntohs(h->sequence);
if(h->flag != GBT_TAG) return DATA_PARSE_BOUNDRY_FLAG_MISSING;
if(h->flag != GBT_TAG) return DATA_PARSE_BOUNDARY_FLAG_MISSING;
if(sequence == 1) {
if(buf == NULL) buf = (uint8_t *)malloc((size_t)1024); // TODO find out from first package ?

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "GcmParser.h"
#include "lwip/def.h"
#if defined(ESP8266)
@@ -11,45 +17,60 @@ GCMParser::GCMParser(uint8_t *encryption_key, uint8_t *authentication_key) {
memcpy(this->authentication_key, authentication_key, 16);
}
int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) {
int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx, bool hastag) {
if(ctx.length < 12) return DATA_PARSE_INCOMPLETE;
uint32_t headersize = 0;
uint8_t* ptr = (uint8_t*) d;
if(*ptr != GCM_TAG) return DATA_PARSE_BOUNDRY_FLAG_MISSING;
ptr++;
if(hastag) {
if(*ptr != GCM_TAG) return DATA_PARSE_BOUNDARY_FLAG_MISSING;
ptr++;
headersize++;
}
// Encrypted APDU
// http://www.weigu.lu/tutorials/sensors2bus/04_encryption/index.html
uint8_t systemTitleLength = *ptr;
ptr++;
headersize++;
uint8_t initialization_vector[12];
memcpy(ctx.system_title, ptr, systemTitleLength);
memcpy(initialization_vector, ctx.system_title, systemTitleLength);
memset(ctx.system_title, 0, 8);
memset(initialization_vector, 0, 12);
if(systemTitleLength > 0) {
memcpy(ctx.system_title, ptr, systemTitleLength);
memcpy(initialization_vector, ctx.system_title, systemTitleLength);
ptr += systemTitleLength;
headersize += systemTitleLength;
}
int len;
int headersize = 2 + systemTitleLength;
ptr += systemTitleLength;
uint32_t len = 0;
if(((*ptr) & 0xFF) == 0x81) {
ptr++;
len = *ptr;
// 1-byte payload length
ptr++;
len = *ptr++;
headersize += 2;
} else if(((*ptr) & 0xFF) == 0x82) {
GCMSizeDef* h = (GCMSizeDef*) ptr;
// 2-byte payload length
len = (ntohs(h->format) & 0xFFFF);
ptr += 3;
ptr++;
len = *ptr++ << 8;
len |= *ptr++;
headersize += 3;
} else if(((*ptr) & 0xFF) == 0x84) {
// 4-byte payload length
ptr++;
len = *ptr++ << 24;
len |= *ptr++ << 16;
len |= *ptr++ << 8;
len |= *ptr++;
headersize += 5;
} else {
len = *ptr++;
headersize++;
}
if(len + headersize > ctx.length)
return DATA_PARSE_INCOMPLETE;
//Serial.printf("\nL: %d : %d, %d\n", length, len, headersize);
uint8_t additional_authenticated_data[17];
memcpy(additional_authenticated_data, ptr, 1);
@@ -66,6 +87,7 @@ int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) {
int footersize = 0;
// Authentication enabled
bool authenticate = false;
uint8_t authentication_tag[12];
uint8_t authkeylen = 0, aadlen = 0;
if((sec & 0x10) == 0x10) {
@@ -74,6 +96,7 @@ int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) {
footersize += authkeylen;
memcpy(additional_authenticated_data + 1, authentication_key, 16);
memcpy(authentication_tag, ptr + len - footersize - 5, authkeylen);
for(uint8_t i; i < 16; i++) authenticate |= authentication_key[i] > 0;
}
#if defined(ESP8266)
@@ -82,7 +105,7 @@ int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) {
br_aes_ct_ctr_init(&bc, encryption_key, 16);
br_gcm_init(&gcmCtx, &bc.vtable, br_ghash_ctmul32);
br_gcm_reset(&gcmCtx, initialization_vector, sizeof(initialization_vector));
if(authkeylen > 0) {
if(authenticate) {
br_gcm_aad_inject(&gcmCtx, additional_authenticated_data, aadlen);
}
br_gcm_flip(&gcmCtx);
@@ -100,7 +123,7 @@ int8_t GCMParser::parse(uint8_t *d, DataParserContext &ctx) {
if (0 != success) {
return GCM_ENCRYPTION_KEY_FAILED;
}
if (0 < authkeylen) {
if (authenticate) {
success = mbedtls_gcm_auth_decrypt(&m_ctx, sizeof(cipher_text), initialization_vector, sizeof(initialization_vector),
additional_authenticated_data, aadlen, authentication_tag, authkeylen,
cipher_text, (unsigned char*)(ptr));

View File

@@ -0,0 +1,105 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "HdlcParser.h"
#include "lwip/def.h"
#include "crc.h"
int8_t HDLCParser::parse(uint8_t *d, DataParserContext &ctx) {
int len;
uint8_t* ptr;
if(ctx.length < 3)
return DATA_PARSE_INCOMPLETE;
HDLCHeader* h = (HDLCHeader*) d;
ptr = (uint8_t*) &h[1];
// Frame format type 3
if((h->format & 0xF0) == 0xA0) {
// Length field (11 lsb of format)
len = (ntohs(h->format) & 0x7FF) + 2;
if(len > ctx.length)
return DATA_PARSE_INCOMPLETE;
HDLCFooter* f = (HDLCFooter*) (d + len - sizeof *f);
// First and last byte should be HDLC_FLAG
if(h->flag != HDLC_FLAG || f->flag != HDLC_FLAG)
return DATA_PARSE_BOUNDARY_FLAG_MISSING;
// Verify FCS
if(f->fcs > 0 && ntohs(f->fcs) != crc16_x25(d + 1, len - sizeof *f - 1))
return DATA_PARSE_FOOTER_CHECKSUM_ERROR;
// Skip destination address, LSB marks last byte
while(((*ptr) & 0x01) == 0x00) {
ptr++;
}
ptr++;
// Skip source address, LSB marks last byte
while(((*ptr) & 0x01) == 0x00) {
ptr++;
}
ptr++;
HDLC3CtrlHcs* t3 = (HDLC3CtrlHcs*) (ptr);
// Verify HCS
if(t3->hcs > 0 && ntohs(t3->hcs) != crc16_x25(d + 1, ptr-d))
return DATA_PARSE_HEADER_CHECKSUM_ERROR;
ptr += 3;
// Exclude all of header and 3 byte footer
ctx.length -= ptr-d;
if(ctx.length > 1) {
ctx.length -= 3;
}
// Payload incomplete
if((h->format & 0x08) == 0x08) {
if(lastSequenceNumber == 0) {
if(buf == NULL) buf = (uint8_t *)malloc((size_t)1024);
pos = 0;
}
if(buf == NULL) return DATA_PARSE_FAIL;
if((*ptr) == DATA_TAG_LLC) {
ptr += 3; // Skip LLC
ctx.length -= 3;
}
memcpy(buf + pos, ptr, ctx.length);
pos += ctx.length;
lastSequenceNumber++;
return DATA_PARSE_INTERMEDIATE_SEGMENT;
} else if(lastSequenceNumber > 0) {
lastSequenceNumber = 0;
if(buf == NULL) return DATA_PARSE_FAIL;
if((*ptr) == DATA_TAG_LLC) {
ptr += 3; // Skip LLC
ctx.length -= 3;
}
memcpy(buf + pos, ptr, ctx.length);
pos += ctx.length;
memcpy((uint8_t *) d, buf, pos);
free(buf);
buf = NULL;
ctx.length = pos;
pos = 0;
return DATA_PARSE_OK;
} else {
return ptr-d;
}
}
return DATA_PARSE_UNKNOWN_DATA;
}

View File

@@ -1,7 +1,12 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "LlcParser.h"
int8_t LLCParser::parse(uint8_t *buf, DataParserContext &ctx) {
LLCHeader* llc = (LLCHeader*) buf;
ctx.length -= 3;
return 3;
}

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "MbusParser.h"
int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) {
@@ -5,8 +11,6 @@ int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) {
int headersize = 3;
int footersize = 1;
uint8_t flag = *d;
uint8_t* ptr;
// https://m-bus.com/documentation-wired/06-application-layer
@@ -15,7 +19,7 @@ int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) {
MbusHeader* mh = (MbusHeader*) d;
if(mh->flag1 != MBUS_START || mh->flag2 != MBUS_START)
return DATA_PARSE_BOUNDRY_FLAG_MISSING;
return DATA_PARSE_BOUNDARY_FLAG_MISSING;
// First two bytes is 1-byte length value repeated. Only used for last segment
if(mh->len1 != mh->len2)
@@ -36,7 +40,7 @@ int8_t MBUSParser::parse(uint8_t *d, DataParserContext &ctx) {
MbusFooter* mf = (MbusFooter*) (d + len + headersize);
if(mf->flag != MBUS_END)
return DATA_PARSE_BOUNDRY_FLAG_MISSING;
return DATA_PARSE_BOUNDARY_FLAG_MISSING;
if(checksum(d + headersize, len) != mf->fcs)
return DATA_PARSE_FOOTER_CHECKSUM_ERROR;

View File

@@ -0,0 +1,35 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "crc.h"
uint16_t crc16_x25(const uint8_t* p, int len)
{
uint16_t crc = UINT16_MAX;
while(len--)
for (uint16_t i = 0, d = 0xff & *p++; i < 8; i++, d >>= 1)
crc = ((crc & 1) ^ (d & 1)) ? (crc >> 1) ^ 0x8408 : (crc >> 1);
return (~crc << 8) | (~crc >> 8 & 0xff);
}
uint16_t crc16 (const uint8_t *p, int len) {
uint16_t crc = 0;
while (len--) {
uint8_t i;
crc ^= *p++;
for (i = 0 ; i < 8 ; ++i) {
if (crc & 1)
crc = (crc >> 1) ^ 0xa001;
else
crc = (crc >> 1);
}
}
return crc;
}

View File

@@ -1,3 +1,9 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "ntohll.h"
uint64_t ntohll(uint64_t x) {

View File

@@ -0,0 +1,153 @@
#pragma once
#include <stdint.h>
#include <Print.h>
#include "HwTools.h"
#include "AmsData.h"
#include "AmsConfiguration.h"
#if defined(ESP32)
#include "esp_flash_partitions.h"
#include "LittleFS.h"
#include "WiFi.h"
#include "HTTPClient.h"
#define AMS_PARTITION_TABLE_OFFSET 0x8000
#define AMS_PARTITION_APP0_OFFSET 0x10000
#define AMS_PARTITION_APP_SIZE 0x1D0000
#define AMS_PARTITION_MIN_SPIFFS_SIZE 0x20000
#elif defined(ESP8266)
#include <ESP8266HTTPClient.h>
#define AMS_FLASH_SKETCH_SIZE 0xFEFF0
#define AMS_FLASH_OTA_START AMS_FLASH_OTA_SIZE
#endif
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#define AMS_UPDATE_ERR_OK 0
#define AMS_UPDATE_ERR_DETAILS 1
#define AMS_UPDATE_ERR_FETCH 2
#define AMS_UPDATE_ERR_ERASE 3
#define AMS_UPDATE_ERR_WRITE 4
#define AMS_UPDATE_ERR_READ 5
#define AMS_UPDATE_ERR_MD5 6
#define AMS_UPDATE_ERR_ACTIVATE 7
#define AMS_UPDATE_ERR_REBOOT 64
#define AMS_UPDATE_ERR_SUCCESS_SIGNAL 122
#define AMS_UPDATE_ERR_SUCCESS_CONFIRMED 123
#define UPDATE_BUF_SIZE 4096
#define UPDATE_MAX_BLOCK_RETRY 25
#define UPDATE_MAX_REBOOT_RETRY 12
class AmsFirmwareUpdater {
public:
#if defined(AMS_REMOTE_DEBUG)
AmsFirmwareUpdater(RemoteDebug* debugger, HwTools* hw, AmsData* meterState);
#else
AmsFirmwareUpdater(Print* debugger, HwTools* hw, AmsData* meterState);
#endif
bool relocateOrRepartitionIfNecessary();
void loop();
char* getNextVersion();
bool setTargetVersion(const char* version);
void getUpgradeInformation(UpgradeInformation&);
float getProgress();
bool activateDownloadedFirmware();
void setUpgradeInformation(UpgradeInformation&);
bool isUpgradeInformationChanged();
void ackUpgradeInformationChanged();
void setFirmwareChannel(uint8_t channel) {
if(firmwareChannel != channel) {
firmwareChannel = channel;
lastVersionCheck = 0;
}
}
bool startFirmwareUpload(uint32_t size, const char* version);
bool addFirmwareUploadChunk(uint8_t* buf, size_t length);
bool completeFirmwareUpload(uint32_t size);
private:
#if defined(ESP8266)
char chipType[10] = "esp8266";
#elif defined(CONFIG_IDF_TARGET_ESP32S2)
char chipType[10] = "esp32s2";
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
char chipType[10] = "esp32s3";
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
char chipType[10] = "esp32c3";
#elif defined(ESP32)
#if defined(CONFIG_FREERTOS_UNICORE)
char chipType[10] = "esp32solo";
#else
char chipType[10] = "esp32";
#endif
#endif
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Print* debugger;
#endif
HwTools* hw;
AmsData* meterState;
bool updateStatusChanged = false;
UpgradeInformation updateStatus = {"","",0,0,0,0,0};
uint16_t lastSaveBlocksWritten = 0;
String md5;
uint32_t lastVersionCheck = 0;
uint8_t firmwareChannel;
bool autoUpgrade;
char nextVersion[17];
void getChannelName(char * buffer);
bool fetchNextVersion();
bool fetchVersionDetails();
bool fetchFirmwareChunk(HTTPClient& http);
bool writeBufferToFlash();
bool verifyChecksum();
bool activateNewFirmware();
bool writeUpdateStatus();
bool isFlashReadyForNextUpdateVersion(uint32_t size);
uint8_t* buf = NULL;
uint16_t bufPos = 0;
#if defined(ESP32)
bool readPartition(uint8_t num, const esp_partition_info_t* info);
bool writePartition(uint8_t num, const esp_partition_info_t* info);
bool copyData(const esp_partition_info_t* src, esp_partition_info_t* dst, bool eraseFirst=true);
bool copyFile(fs::LittleFSFS* src, fs::LittleFSFS* dst, const char* filename);
uint8_t* extractFileData(const char* filename, size_t& size);
void saveFileData(const char* filename, uint8_t* data, size_t size);
bool relocateAppToFirst(const esp_partition_t* active);
bool findPartition(const char* label, const esp_partition_info_t* info);
bool hasLargeEnoughAppPartitions();
bool canMigratePartitionTable();
bool hasTwoSpiffs();
bool spiffsOnCorrectLocation();
bool hasFiles();
bool clearPartitionTable();
bool writeNewPartitionChecksum(uint8_t num);
bool writePartitionTableWithSpiffsAtOldAndApp1();
bool writePartitionTableWithSpiffsAtApp1AndNew();
bool writePartitionTableFinal();
bool moveLittleFsFromOldToApp1();
bool moveLittleFsFromApp1ToNew();
#elif defined(ESP8266)
uintptr_t getFirmwareUpdateStart();
#endif
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
#pragma once
#include "AmsDataStorage.h"
class AmsJsonGenerator {
public:
static void generateDayPlotJson(AmsDataStorage* ds, char* buf, size_t bufSize);
static void generateMonthPlotJson(AmsDataStorage* ds, char* buf, size_t bufSize);
};

View File

@@ -0,0 +1,17 @@
#include "AmsJsonGenerator.h"
void AmsJsonGenerator::generateDayPlotJson(AmsDataStorage* ds, char* buf, size_t bufSize) {
uint16_t pos = snprintf_P(buf, bufSize, PSTR("{\"unit\":\"kwh\""));
for(uint8_t i = 0; i < 24; i++) {
pos += snprintf_P(buf+pos, bufSize-pos, PSTR(",\"i%02d\":%.3f,\"e%02d\":%.3f"), i, ds->getHourImport(i) / 1000.0, i, ds->getHourExport(i) / 1000.0);
}
snprintf_P(buf+pos, bufSize-pos, PSTR("}"));
}
void AmsJsonGenerator::generateMonthPlotJson(AmsDataStorage* ds, char* buf, size_t bufSize) {
uint16_t pos = snprintf_P(buf, bufSize, PSTR("{\"unit\":\"kwh\""));
for(uint8_t i = 1; i < 32; i++) {
pos += snprintf_P(buf+pos, bufSize-pos, PSTR(",\"i%02d\":%.3f,\"e%02d\":%.3f"), i, ds->getDayImport(i) / 1000.0, i, ds->getDayExport(i) / 1000.0);
}
snprintf_P(buf+pos, bufSize-pos, PSTR("}"));
}

View File

@@ -0,0 +1,102 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _AMSMQTTHANDLER_H
#define _AMSMQTTHANDLER_H
#include "Arduino.h"
#include <MQTT.h>
#include "AmsData.h"
#include "AmsConfiguration.h"
#include "EnergyAccounting.h"
#include "HwTools.h"
#include "PriceService.h"
#include "AmsFirmwareUpdater.h"
#if defined(ESP32)
#include <esp_task_wdt.h>
#endif
class AmsMqttHandler {
public:
#if defined(AMS_REMOTE_DEBUG)
AmsMqttHandler(MqttConfig& mqttConfig, RemoteDebug* debugger, char* buf, AmsFirmwareUpdater* updater) {
#else
AmsMqttHandler(MqttConfig& mqttConfig, Stream* debugger, char* buf, AmsFirmwareUpdater* updater) {
#endif
this->mqttConfig = mqttConfig;
this->mqttConfigChanged = true;
this->debugger = debugger;
this->json = buf;
this->updater = updater;
mqtt.dropOverflow(true);
pubTopic = String(mqttConfig.publishTopic);
subTopic = String(mqttConfig.subscribeTopic);
if(subTopic.isEmpty()) subTopic = pubTopic+"/command";
};
void setCaVerification(bool);
void setConfig(MqttConfig& mqttConfig);
bool connect();
bool defaultSubscribe();
void disconnect();
lwmqtt_err_t lastError();
bool connected();
bool loop();
bool isRebootSuggested();
virtual uint8_t getFormat() { return 0; };
virtual bool postConnect() { return false; };
virtual bool publish(AmsData* data, AmsData* previousState, EnergyAccounting* ea, PriceService* ps) { return false; };
virtual bool publishTemperatures(AmsConfiguration*, HwTools*) { return false; };
virtual bool publishPrices(PriceService* ps) { return false; };
virtual bool publishSystem(HwTools*, PriceService*, EnergyAccounting*) { return false; };
virtual bool publishRaw(uint8_t* raw, size_t length) { return false; };
virtual bool publishFirmware() { return false; };
virtual void onMessage(String &topic, String &payload) {};
virtual ~AmsMqttHandler() {
if(mqttSecureClient != NULL) {
mqttSecureClient->stop();
delete mqttSecureClient;
}
if(mqttClient != NULL) {
mqttClient->stop();
delete mqttClient;
}
};
protected:
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Stream* debugger;
#endif
MqttConfig mqttConfig;
bool mqttConfigChanged = true;
MQTTClient mqtt = MQTTClient(256);
unsigned long lastMqttRetry = -10000;
bool caVerification = true;
WiFiClient *mqttClient = NULL;
WiFiClientSecure *mqttSecureClient = NULL;
boolean _connected = false;
char* json;
uint16_t BufferSize = 2048;
uint64_t lastStateUpdate = 0;
uint64_t lastSuccessfulLoop = 0;
String pubTopic;
String subTopic;
AmsFirmwareUpdater* updater = NULL;
bool rebootSuggested = false;
};
#endif

View File

@@ -0,0 +1,223 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "AmsMqttHandler.h"
#include "FirmwareVersion.h"
#include "AmsStorage.h"
#include "LittleFS.h"
#include "Uptime.h"
void AmsMqttHandler::setCaVerification(bool caVerification) {
this->caVerification = caVerification;
}
void AmsMqttHandler::setConfig(MqttConfig& mqttConfig) {
this->mqttConfig = mqttConfig;
this->mqttConfigChanged = true;
}
bool AmsMqttHandler::connect() {
if(millis() - lastMqttRetry < 10000) {
yield();
return false;
}
lastMqttRetry = millis();
time_t epoch = time(nullptr);
WiFiClient *actualClient = NULL;
if(mqttConfig.ssl) {
if(epoch < FirmwareVersion::BuildEpoch) {
return false;
}
bool applySslConfiguration = mqttConfigChanged;
if(mqttSecureClient == NULL) {
mqttSecureClient = new WiFiClientSecure();
#if defined(ESP8266)
mqttSecureClient->setBufferSizes(512, 512);
return false;
#endif
applySslConfiguration = true;
}
if(applySslConfiguration) {
if(caVerification && LittleFS.begin()) {
File file;
if(LittleFS.exists(FILE_MQTT_CA)) {
file = LittleFS.open(FILE_MQTT_CA, (char*) "r");
#if defined(ESP8266)
BearSSL::X509List *serverTrustedCA = new BearSSL::X509List(file);
mqttSecureClient->setTrustAnchors(serverTrustedCA);
#elif defined(ESP32)
if(!mqttSecureClient->loadCACert(file, file.size())) {
return false;
}
#endif
file.close();
} else {
mqttSecureClient->setInsecure();
}
#if defined(ESP8266)
if(LittleFS.exists(FILE_MQTT_CERT) && LittleFS.exists(FILE_MQTT_KEY)) {
file = LittleFS.open(FILE_MQTT_CERT, (char*) "r");
BearSSL::X509List *serverCertList = new BearSSL::X509List(file);
file.close();
file = LittleFS.open(FILE_MQTT_KEY, (char*) "r");
BearSSL::PrivateKey *serverPrivKey = new BearSSL::PrivateKey(file);
file.close();
mqttSecureClient->setClientRSACert(serverCertList, serverPrivKey);
}
#endif
#if defined(ESP32)
if(LittleFS.exists(FILE_MQTT_CERT)) {
file = LittleFS.open(FILE_MQTT_CERT, (char*) "r");
mqttSecureClient->loadCertificate(file, file.size());
file.close();
}
if(LittleFS.exists(FILE_MQTT_KEY)) {
file = LittleFS.open(FILE_MQTT_KEY, (char*) "r");
mqttSecureClient->loadPrivateKey(file, file.size());
file.close();
}
#endif
} else {
mqttSecureClient->setInsecure();
}
}
actualClient = mqttSecureClient;
} else {
if(mqttClient == NULL) {
mqttClient = new WiFiClient();
}
actualClient = mqttClient;
}
// This section helps with power saving on ESP32 devices by reducing timeouts
// The timeout is multiplied by 10 because WiFiClient is retrying 10 times internally
// Power drain for this timeout is too great when using the default 3s timeout
// On ESP8266 the timeout is used differently and the following code causes MQTT instability
#if defined(ESP32)
int clientTimeout = mqttConfig.timeout / 1000;
if(clientTimeout > 3) clientTimeout = 3; // 3000ms is default, see WiFiClient.cpp WIFI_CLIENT_DEF_CONN_TIMEOUT_MS
actualClient->setTimeout(clientTimeout);
// Why can't we set number of retries for write here? WiFiClient defaults to 10 (10*3s == 30s)
#endif
mqttConfigChanged = false;
mqtt.setTimeout(mqttConfig.timeout);
mqtt.setKeepAlive(mqttConfig.keepalive);
mqtt.begin(mqttConfig.host, mqttConfig.port, *actualClient);
String statusTopic = String(mqttConfig.publishTopic) + "/status";
mqtt.setWill(statusTopic.c_str(), "offline", true, 0);
#if defined(ESP8266)
if(mqttSecureClient) {
time_t epoch = time(nullptr);
mqttSecureClient->setX509Time(epoch);
}
#endif
// Connect to a unsecure or secure MQTT server
if ((strlen(mqttConfig.username) == 0 && mqtt.connect(mqttConfig.clientId)) ||
(strlen(mqttConfig.username) > 0 && mqtt.connect(mqttConfig.clientId, mqttConfig.username, mqttConfig.password))) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::INFO))
#endif
debugger->printf_P(PSTR("Successfully connected to MQTT\n"));
mqtt.onMessage(std::bind(&AmsMqttHandler::onMessage, this, std::placeholders::_1, std::placeholders::_2));
_connected = mqtt.publish(statusTopic, "online", true, 0);
mqtt.loop();
defaultSubscribe();
postConnect();
return true;
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
{
debugger->printf_P(PSTR("Failed to connect to MQTT: %d\n"), mqtt.lastError());
#if defined(ESP8266)
if(mqttSecureClient) {
mqttSecureClient->getLastSSLError((char*) json, BufferSize);
debugger->println((char*) json);
}
#endif
}
return false;
}
}
bool AmsMqttHandler::defaultSubscribe() {
bool ret = true;
if(!subTopic.isEmpty()) {
if(mqtt.subscribe(subTopic)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR(" Subscribed to [%s]\n"), subTopic.c_str());
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR(" Unable to subscribe to [%s]\n"), subTopic.c_str());
ret = false;
}
}
return ret;
}
void AmsMqttHandler::disconnect() {
mqtt.disconnect();
mqtt.loop();
_connected = false;
delay(10);
yield();
}
lwmqtt_err_t AmsMqttHandler::lastError() {
return mqtt.lastError();
}
bool AmsMqttHandler::connected() {
return _connected && mqtt.connected();
}
bool AmsMqttHandler::loop() {
uint64_t now = millis64();
bool ret = connected() && mqtt.loop();
if(ret) {
lastSuccessfulLoop = now;
} else if(mqttConfig.rebootMinutes > 0) {
if(now - lastSuccessfulLoop > (uint64_t) mqttConfig.rebootMinutes * 60000) {
// Reboot the device if the MQTT connection is lost for too long
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::WARNING))
#endif
debugger->printf_P(PSTR("MQTT connection lost for over %d minutes, rebooting device\n"), mqttConfig.rebootMinutes);
rebootSuggested = true;
}
}
delay(10); // Needed to preserve power. After adding this, the voltage is super smooth on a HAN powered device
yield();
#if defined(ESP32)
esp_task_wdt_reset();
#elif defined(ESP8266)
ESP.wdtFeed();
#endif
return ret;
}
bool AmsMqttHandler::isRebootSuggested() {
return rebootSuggested;
}

View File

@@ -0,0 +1,135 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _CLOUDCONNECTOR_H
#define _CLOUDCONNECTOR_H
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#include "mbedtls/ssl.h"
#include "mbedtls/platform.h"
#include "mbedtls/net.h"
#include "mbedtls/esp_debug.h"
#include "mbedtls/entropy.h"
#include "mbedtls/ctr_drbg.h"
#include "mbedtls/error.h"
#include "mbedtls/certs.h"
#include "mbedtls/rsa.h"
#include "AmsConfiguration.h"
#include "AmsData.h"
#include "EnergyAccounting.h"
#include "HwTools.h"
#include "AmsMqttHandler.h"
#include "ConnectionHandler.h"
#if defined(ESP8266)
#include <ESP8266HTTPClient.h>
#elif defined(ESP32) // ARDUINO_ARCH_ESP32
#include <HTTPClient.h>
#include <esp_wifi.h>
#include <esp_task_wdt.h>
#include <WiFiUdp.h>
#else
#warning "Unsupported board type"
#endif
#define CC_BUF_SIZE 4096
static const char CC_JSON_POWER[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu}";
static const char CC_JSON_POWER_LIST3[] PROGMEM = ",\"%s\":{\"P\":%lu,\"Q\":%lu,\"tP\":%.3f,\"tQ\":%.3f}";
static const char CC_JSON_PHASE[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s}";
static const char CC_JSON_PHASE_LIST4[] PROGMEM = "%s\"%d\":{\"u\":%.2f,\"i\":%s,\"Pim\":%lu,\"Pex\":%lu,\"pf\":%.2f}";
static const char CC_JSON_STATUS[] PROGMEM = ",\"status\":{\"esp\":{\"state\":%d,\"error\":%d},\"han\":{\"state\":%d,\"error\":%d},\"wifi\":{\"state\":%d,\"error\":%d},\"mqtt\":{\"state\":%d,\"error\":%d}}";
static const char CC_JSON_INIT[] PROGMEM = ",\"init\":{\"mac\":\"%s\",\"apmac\":\"%s\",\"version\":\"%s\",\"boardType\":%d,\"bootReason\":%d,\"bootCause\":%d,\"tz\":\"%s\"},\"meter\":{\"manufacturerId\":%d,\"manufacturer\":\"%s\",\"model\":\"%s\",\"id\":\"%s\",\"system\":\"%s\",\"fuse\":%d,\"import\":%d,\"export\":%d},\"network\":{\"ip\":\"%s\",\"mask\":\"%s\",\"gw\":\"%s\",\"dns1\":\"%s\",\"dns2\":\"%s\"}";
struct CloudData {
uint8_t type;
int16_t data;
} __attribute__((packed));
class CloudConnector {
public:
#if defined(AMS_REMOTE_DEBUG)
CloudConnector(RemoteDebug*);
#else
CloudConnector(Stream*);
#endif
bool setup(CloudConfig& config, MeterConfig& meter, SystemConfig& system, NtpConfig& ntp, HwTools* hw, ResetDataContainer* rdc, PriceService* ps);
void setMqttHandler(AmsMqttHandler* mqttHandler);
void update(AmsData& data, EnergyAccounting& ea);
void setPriceConfig(PriceServiceConfig&);
void setEnergyAccountingConfig(EnergyAccountingConfig&);
void forceUpdate();
void forcePriceUpdate();
void setConnectionHandler(ConnectionHandler* ch);
String generateSeed();
private:
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger = NULL;
#else
Stream* debugger = NULL;
#endif
HwTools* hw = NULL;
ConnectionHandler* ch = NULL;
ResetDataContainer* rdc = NULL;
PriceService* ps = NULL;
AmsMqttHandler* mqttHandler = NULL;
CloudConfig config;
PriceServiceConfig priceConfig;
unsigned long lastPriceConfig = 0;
EnergyAccountingConfig eac;
unsigned long lastEac = 0;
HTTPClient http;
WiFiUDP udp;
WiFiClient tcp;
int maxPwr = 0;
uint8_t boardType = 0;
char timezone[32];
uint8_t distributionSystem = 0;
uint16_t mainFuse = 0, productionCapacity = 0;
String uuid;
bool initialized = false;
unsigned long lastUpdate = 0;
char mac[18];
char apmac[18];
String seed = "";
char clearBuffer[CC_BUF_SIZE];
uint8_t* httpBuffer = NULL;
unsigned char encryptedBuffer[256];
mbedtls_rsa_context* rsa = nullptr;
mbedtls_ctr_drbg_context ctr_drbg;
mbedtls_entropy_context entropy;
char* pers = "amsreader";
bool init();
String meterManufacturer(uint8_t type) {
switch(type) {
case AmsTypeAidon: return F("Aidon");
case AmsTypeKaifa: return F("Kaifa");
case AmsTypeKamstrup: return F("Kamstrup");
case AmsTypeIskra: return F("Iskra");
case AmsTypeLandisGyr: return F("Landis+Gyr");
case AmsTypeSagemcom: return F("Sagemcom");
}
return F("");
}
String distributionSystemStr(uint8_t ds) {
switch(ds) {
case 1: return F("IT");
case 2: return F("TN");
}
return F("");
}
};
#endif

View File

@@ -0,0 +1,630 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#include "CloudConnector.h"
#include "FirmwareVersion.h"
#include "crc.h"
#include "Uptime.h"
#include "hexutils.h"
#if defined(ESP32)
#include <ESPRandom.h>
#endif
#if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#include "esp32/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S2
#include "esp32s2/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32C3
#include "esp32c3/rom/rtc.h"
#elif CONFIG_IDF_TARGET_ESP32S3
#include "esp32s3/rom/rtc.h"
#endif
#if defined(AMS_REMOTE_DEBUG)
CloudConnector::CloudConnector(RemoteDebug* debugger) {
#else
CloudConnector::CloudConnector(Stream* debugger) {
#endif
this->debugger = debugger;
http.setFollowRedirects(HTTPC_STRICT_FOLLOW_REDIRECTS);
http.setReuse(false);
http.setTimeout(60000);
http.setUserAgent("ams2mqtt/" + String(FirmwareVersion::VersionString));
http.useHTTP10(true);
uint8_t mac[6];
uint8_t apmac[6];
#if defined(ESP8266)
wifi_get_macaddr(STATION_IF, mac);
wifi_get_macaddr(SOFTAP_IF, apmac);
#elif defined(ESP32)
esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac);
esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_AP, apmac);
#endif
sprintf_P(this->mac, PSTR("%02X:%02X:%02X:%02X:%02X:%02X"), mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
sprintf_P(this->apmac, PSTR("%02X:%02X:%02X:%02X:%02X:%02X"), apmac[0], apmac[1], apmac[2], apmac[3], apmac[4], apmac[5]);
}
bool CloudConnector::setup(CloudConfig& config, MeterConfig& meter, SystemConfig& system, NtpConfig& ntp, HwTools* hw, ResetDataContainer* rdc, PriceService* ps) {
bool ret = false;
#if defined(ESP32)
if(!ESPRandom::isValidV4Uuid(config.clientId)) {
ESPRandom::uuid4(config.clientId);
ret = true;
}
uuid = ESPRandom::uuidToString(config.clientId);
#endif
this->config = config;
this->hw = hw;
this->rdc = rdc;
this->ps = ps;
this->boardType = system.boardType;
strcpy(this->timezone, ntp.timezone);
this->maxPwr = 0;
this->distributionSystem = meter.distributionSystem;
this->mainFuse = meter.mainFuse;
this->productionCapacity = meter.productionCapacity;
this->initialized = false;
return ret;
}
void CloudConnector::setMqttHandler(AmsMqttHandler* mqttHandler) {
this->mqttHandler = mqttHandler;
}
bool CloudConnector::init() {
if(config.enabled) {
//if(config.port == 0)
config.port = 7443;
//if(strlen(config.hostname) == 0)
strcpy_P(config.hostname, PSTR("cloud.amsleser.no"));
snprintf_P(clearBuffer, CC_BUF_SIZE, PSTR("http://%s/hub/cloud/public.key"), config.hostname);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::INFO))
#endif
debugger->printf_P(PSTR("(CloudConnector) Downloading public key from %s\n"), clearBuffer);
#if defined(ESP8266)
WiFiClient client;
client.setTimeout(5000);
if(http.begin(client, clearBuffer)) {
#elif defined(ESP32)
if(http.begin(clearBuffer)) {
#endif
int status = http.GET();
#if defined(ESP32)
esp_task_wdt_reset();
#elif defined(ESP8266)
ESP.wdtFeed();
#endif
if(status == HTTP_CODE_OK) {
String pub = http.getString();
http.end();
memset(clearBuffer, 0, CC_BUF_SIZE);
snprintf(clearBuffer, CC_BUF_SIZE, pub.c_str());
mbedtls_pk_context pk;
mbedtls_pk_init(&pk);
int error_code = 0;
if((error_code = mbedtls_pk_parse_public_key(&pk, (unsigned char*) clearBuffer, strlen((const char*) clearBuffer)+1)) == 0){
rsa = mbedtls_pk_rsa(pk);
mbedtls_ctr_drbg_init(&ctr_drbg);
mbedtls_entropy_init(&entropy);
int ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
&entropy, (const unsigned char *) pers,
strlen(pers));
if(ret != 0) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("mbedtls_ctr_drbg_seed return code: %d\n"), ret);
}
return ret == 0;
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf("RSA public key read error: ");
mbedtls_strerror(error_code, clearBuffer, CC_BUF_SIZE);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf("%s\n", clearBuffer);
}
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("(CloudConnector) Communication error, returned status: %d\n"), status);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf(http.errorToString(status).c_str());
debugger->println();
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf(http.getString().c_str());
http.end();
}
}
}
return false;
}
void CloudConnector::update(AmsData& data, EnergyAccounting& ea) {
unsigned long now = millis();
if(now-lastUpdate < ((unsigned long)config.interval)*1000) {
return;
};
bool sendFirst = lastUpdate == 0;
lastUpdate = now;
if(config.enabled) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::VERBOSE))
#endif
debugger->printf_P(PSTR("(CloudConnector) Enabled\n"));
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::VERBOSE))
#endif
debugger->printf_P(PSTR("(CloudConnector) Not enabled\n"));
return;
}
if(!ESPRandom::isValidV4Uuid(config.clientId)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::WARNING))
#endif
debugger->printf_P(PSTR("(CloudConnector) Client ID is not valid\n"));
return;
}
if(data.getListType() < 2) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::VERBOSE))
#endif
debugger->printf_P(PSTR("(CloudConnector) List type not enough data\n"));
return;
}
if(!initialized && !init()) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::WARNING))
#endif
debugger->printf_P(PSTR("Unable to initialize cloud connector\n"));
return;
}
initialized = true;
memset(clearBuffer, 0, CC_BUF_SIZE);
int pos = 0;
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"id\":\"%s\""), uuid.c_str());
if(!seed.isEmpty()) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"seed\":\"%s\""), seed.c_str());
}
bool sendData = true;
if(sendFirst) {
seed.clear();
if(mainFuse > 0 && distributionSystem > 0) {
int voltage = distributionSystem == 2 ? 400 : 230;
if(data.isThreePhase()) {
maxPwr = mainFuse * sqrt(3) * voltage;
} else if(data.isTwoPhase()) {
maxPwr = mainFuse * voltage;
} else {
maxPwr = mainFuse * 230;
}
}
IPAddress localIp;
IPAddress subnet;
IPAddress gateway;
IPAddress dns1;
IPAddress dns2;
if(ch == NULL) {
localIp = WiFi.localIP();
subnet = IPAddress(255,255,255,0);
gateway = WiFi.subnetMask();
dns1 = WiFi.dnsIP(0);
dns2 = WiFi.dnsIP(1);
} else {
localIp = ch->getIP();
subnet = ch->getSubnetMask();
gateway = ch->getGateway();
dns1 = ch->getDns(0);
dns2 = ch->getDns(1);
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_INIT,
mac,
apmac,
FirmwareVersion::VersionString,
boardType,
rtc_get_reset_reason(0),
rdc == NULL ? 0 : rdc->last_cause,
timezone,
data.getMeterType(),
meterManufacturer(data.getMeterType()).c_str(),
data.getMeterModel().c_str(),
data.getMeterId().c_str(),
distributionSystemStr(distributionSystem).c_str(),
mainFuse,
maxPwr,
productionCapacity,
localIp.toString().c_str(),
subnet.toString().c_str(),
gateway.toString().c_str(),
dns1.toString().c_str(),
dns2.toString().c_str()
);
} else if(lastPriceConfig == 0) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"price\":{\"area\":\"%s\",\"currency\":\"%s\",\"modifiers\":["), priceConfig.area, priceConfig.currency);
if(ps != NULL) {
std::vector<PriceConfig> pc = ps->getPriceConfig();
if(pc.size() > 0) {
for(uint8_t i = 0; i < pc.size(); i++) {
PriceConfig& p = pc.at(i);
String days;
for(uint8_t d = 0; d < 7; d++) {
if((p.days >> d) & 0x1 == 0x1) {
days += String(d, 10) + ",";
}
}
days = days.substring(0, days.length()-1);
String hours;
for(uint8_t h = 0; h < 24; h++) {
if((p.hours >> h) & 0x1 == 0x1) {
hours += String(h, 10) + ",";
}
}
hours = hours.substring(0, hours.length()-1);
char start[8];
memset(start, 0, 8);
if(p.start_dayofmonth > 0 && p.start_month > 0) {
snprintf_P(start, 8, PSTR("[%d,%d]"), p.start_month, p.start_dayofmonth);
} else {
strcpy_P(start, PSTR("null"));
}
char end[8];
memset(end, 0, 8);
if(p.end_dayofmonth > 0 && p.end_month > 0) {
snprintf_P(end, 8, PSTR("[%d,%d]"), p.end_month, p.end_dayofmonth);
} else {
strcpy_P(end, PSTR("null"));
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("{\"type\":%d,\"name\":\"%s\",\"dir\":%d,\"days\":[%s],\"hours\":[%s],\"value\":%.4f,\"start\":%s,\"end\":%s}%s"),
p.type,
p.name,
p.direction,
days.c_str(),
hours.c_str(),
p.value / 10000.0,
start,
end,
i == pc.size()-1 ? "" : ","
);
}
}
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("]}"));
lastPriceConfig = now;
sendData = false;
} else if(lastEac == 0) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"accounting\":{\"hours\":%d,\"thresholds\":[%d,%d,%d,%d,%d,%d,%d,%d,%d]}"),
eac.hours,
eac.thresholds[0],
eac.thresholds[1],
eac.thresholds[2],
eac.thresholds[3],
eac.thresholds[4],
eac.thresholds[5],
eac.thresholds[6],
eac.thresholds[7],
eac.thresholds[8]
);
lastEac = now;
}
if(sendData) {
float vcc = 0.0;
int rssi = 0;
float temperature = -127;
if(hw != NULL) {
vcc = hw->getVcc();
rssi = hw->getWifiRssi();
temperature = hw->getTemperature();
}
uint8_t espStatus;
#if defined(ESP8266)
if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage
espStatus = 1;
} else if(vcc > 2.8 && vcc < 3.5) {
espStatus = 1;
} else if(vcc > 2.7 && vcc < 3.6) {
espStatus = 2;
} else {
espStatus = 3;
}
#elif defined(ESP32)
if(vcc < 2.0) { // Voltage not correct, ESP would not run on this voltage
espStatus = 1;
} else if(vcc > 3.1 && vcc < 3.5) {
espStatus = 1;
} else if(vcc > 3.0 && vcc < 3.6) {
espStatus = 2;
} else {
espStatus = 3;
}
#endif
uint8_t hanStatus;
if(data.getLastError() != 0) {
hanStatus = 3;
} else if(data.getLastUpdateMillis() == 0 && now < 30000) {
hanStatus = 0;
} else if(now - data.getLastUpdateMillis() < 15000) {
hanStatus = 1;
} else if(now - data.getLastUpdateMillis() < 30000) {
hanStatus = 2;
} else {
hanStatus = 3;
}
uint8_t wifiStatus;
if(rssi > -75) {
wifiStatus = 1;
} else if(rssi > -95) {
wifiStatus = 2;
} else {
wifiStatus = 3;
}
uint8_t mqttStatus;
if(mqttHandler == NULL) {
mqttStatus = 0;
} else if(mqttHandler->connected()) {
mqttStatus = 1;
} else if(mqttHandler->lastError() == 0) {
mqttStatus = 2;
} else {
mqttStatus = 3;
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"data\":{\"clock\":%lu,\"up\":%lu,\"lastUpdate\":%lu,\"est\":%s"),
(uint32_t) time(nullptr),
(uint32_t) (millis64()/1000),
(uint32_t) (data.getLastUpdateMillis()/1000),
data.isCounterEstimated() ? "true" : "false"
);
if(data.getListType() > 2) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "import", data.getActiveImportPower(), data.getReactiveImportPower(), data.getActiveImportCounter(), data.getReactiveImportCounter());
} else {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "import", data.getActiveImportPower(), data.getReactiveImportPower());
}
if(data.getListType() > 2) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER_LIST3, "export", data.getActiveExportPower(), data.getReactiveExportPower(), data.getActiveExportCounter(), data.getReactiveExportCounter());
} else {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_POWER, "export", data.getActiveExportPower(), data.getReactiveExportPower());
}
if(data.getListType() > 1) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"phases\":{"));
bool first = true;
if(data.getL1Voltage() > 0.0) {
if(data.getListType() > 3) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str(), data.getL1ActiveImportPower(), data.getL1ActiveExportPower(), data.getL1PowerFactor());
} else {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 1, data.getL1Voltage(), String(data.getL1Current(), 2).c_str());
}
first = false;
}
if(data.getL2Voltage() > 0.0) {
if(data.getListType() > 3) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 2, data.getL2Voltage(), String(data.getL2Current(), 2).c_str(), data.getL2ActiveImportPower(), data.getL2ActiveExportPower(), data.getL2PowerFactor());
} else {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 2, data.getL2Voltage(), data.isL2currentMissing() ? "null" : String(data.getL2Current(), 2).c_str());
}
first = false;
}
if(data.getL3Voltage() > 0.0) {
if(data.getListType() > 3) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE_LIST4, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str(), data.getL3ActiveImportPower(), data.getL3ActiveExportPower(), data.getL3PowerFactor());
} else {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_PHASE, first ? "" : ",", 3, data.getL3Voltage(), String(data.getL3Current(), 2).c_str());
}
first = false;
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}"));
}
if(data.getListType() > 3) {
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"pf\":%.2f"), data.getPowerFactor());
}
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"realtime\":{\"import\":%.3f,\"export\":%.3f}"), ea.getUseThisHour(), ea.getProducedThisHour());
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"vcc\":%.2f,\"temp\":%.2f,\"rssi\":%d,\"free\":%d"), vcc, temperature, rssi, ESP.getFreeHeap());
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, CC_JSON_STATUS,
espStatus, 0,
hanStatus, data.getLastError(),
wifiStatus, 0,
mqttStatus, mqttHandler == NULL ? 0 : mqttHandler->lastError()
);
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR("}"));
}
uint16_t crc = crc16((uint8_t*) clearBuffer, pos);
pos += snprintf_P(clearBuffer+pos, CC_BUF_SIZE-pos, PSTR(",\"crc\":\"%04X\"}"), crc);
if(rsa == nullptr) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::WARNING))
#endif
debugger->printf_P(PSTR("RSA is null\n"));
return;
}
int ret = mbedtls_rsa_check_pubkey(rsa);
if(ret != 0) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("mbedtls_rsa_pkcs1_encrypt return code: %d\n"), ret);
mbedtls_strerror(ret, clearBuffer, CC_BUF_SIZE);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("%s\n"), clearBuffer);
return;
}
memset(encryptedBuffer, 0, rsa->len);
int maxlen = rsa->len - 11; // 11 should be the correct padding size for PKCS1
Stream *stream = NULL;
if(config.proto == 0) {
udp.beginPacket(config.hostname, config.port);
stream = &udp;
} else if(config.proto == 1) {
if(!tcp.connected()) {
int ret = tcp.connect(config.hostname, config.port, 1000);
if(ret != 1) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("tcp.connect(%s, %d) return code: %d\n"), config.hostname, config.port, ret);
return;
}
tcp.setTimeout((config.interval * 1000) / 2);
}
while(tcp.available()) tcp.read(); // Empty incoming buffer
stream = &tcp;
} else if(config.proto == 2) {
if(!http.connected()) {
http.setReuse(true);
snprintf_P(clearBuffer, CC_BUF_SIZE, PSTR("http://%s/hub/cloud/data"), config.hostname);
if(!http.begin(clearBuffer)) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("(CloudConnector) Unable to start HTTP connector\n"));
http.end();
return;
}
}
if(httpBuffer == NULL) {
httpBuffer = (uint8_t*) malloc(CC_BUF_SIZE);
}
}
int sendBytes = 0;
for(int i = 0; i < pos; i += maxlen) {
int ret = mbedtls_rsa_pkcs1_encrypt(rsa, mbedtls_ctr_drbg_random, &ctr_drbg, MBEDTLS_RSA_PUBLIC, maxlen, (unsigned char*) (clearBuffer+i), encryptedBuffer);
if(ret == 0) {
if(stream != NULL) {
stream->write(encryptedBuffer, rsa->len);
stream->flush();
} else {
memcpy(httpBuffer + sendBytes, encryptedBuffer, rsa->len);
}
sendBytes += rsa->len;
delay(1);
} else {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("mbedtls_rsa_pkcs1_encrypt return code: %d\n"), ret);
mbedtls_strerror(ret, clearBuffer, CC_BUF_SIZE);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("%s\n"), clearBuffer);
}
}
if(config.proto == 0) {
udp.endPacket();
} else if(config.proto == 1) {
tcp.write("\r\n");
tcp.flush();
} else if(config.proto == 2) {
http.addHeader("Content-Type", "application/octet-stream");
int status = http.POST(httpBuffer, sendBytes);
if(status != 200) {
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf_P(PSTR("(CloudConnector) Communication error 2, returned status: %d\n"), status);
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::ERROR))
#endif
debugger->printf(http.errorToString(status).c_str());
debugger->println();
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf(http.getString().c_str());
http.end();
}
}
#if defined(AMS_REMOTE_DEBUG)
if (debugger->isActive(RemoteDebug::DEBUG))
#endif
debugger->printf_P(PSTR("(CloudConnector) %d bytes sent to %s:%d from %s\n"), sendBytes, config.hostname, config.proto == 2 ? 80 : config.port, uuid.c_str());
}
void CloudConnector::forceUpdate() {
lastUpdate = 0;
lastPriceConfig = 0;
lastEac = 0;
}
void CloudConnector::forcePriceUpdate() {
lastPriceConfig = 0;
}
void CloudConnector::setConnectionHandler(ConnectionHandler* ch) {
this->ch = ch;
}
void CloudConnector::setPriceConfig(PriceServiceConfig& priceConfig) {
this->priceConfig = priceConfig;
this->lastPriceConfig = 0;
}
void CloudConnector::setEnergyAccountingConfig(EnergyAccountingConfig& eac) {
this->eac = eac;
this->lastEac = 0;
}
String CloudConnector::generateSeed() {
uint8_t key[16];
ESPRandom::uuid4(key);
seed = ESPRandom::uuidToString(key);
return seed;
}

View File

@@ -0,0 +1,48 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _CONNECTIONHANDLER_H
#define _CONNECTIONHANDLER_H
#include "AmsConfiguration.h"
#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
esp_netif_t* get_esp_interface_netif(esp_interface_t interface);
#endif
#define NETWORK_MODE_WIFI_CLIENT 1
#define NETWORK_MODE_WIFI_AP 2
#define NETWORK_MODE_ETH_CLIENT 3
class ConnectionHandler {
public:
virtual ~ConnectionHandler() {};
virtual bool connect(NetworkConfig config, SystemConfig sys);
virtual void disconnect(unsigned long reconnectDelay);
virtual bool isConnected();
virtual bool isConfigChanged();
virtual void getCurrentConfig(NetworkConfig& networkConfig);
virtual IPAddress getIP();
virtual IPAddress getSubnetMask();
virtual IPAddress getGateway();
virtual IPAddress getDns(uint8_t idx);
#if defined(ESP32)
virtual IPv6Address getIPv6();
virtual IPv6Address getDNSv6(uint8_t idx);
virtual void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info);
#endif
uint8_t getMode() {
return this->mode;
}
protected:
uint8_t mode;
};
#endif

View File

@@ -0,0 +1,59 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _ETHERNETCONNECTIONHANDLER_H
#define _ETHERNETCONNECTIONHANDLER_H
#include "ConnectionHandler.h"
#include <Arduino.h>
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#define CONNECTION_TIMEOUT 30000
class EthernetConnectionHandler : public ConnectionHandler {
public:
#if defined(AMS_REMOTE_DEBUG)
EthernetConnectionHandler(RemoteDebug* debugger);
#else
EthernetConnectionHandler(Stream* debugger);
#endif
bool connect(NetworkConfig config, SystemConfig sys);
void disconnect(unsigned long reconnectDelay);
bool isConnected();
bool isConfigChanged();
void getCurrentConfig(NetworkConfig& networkConfig);
IPAddress getIP();
IPAddress getSubnetMask();
IPAddress getGateway();
IPAddress getDns(uint8_t idx);
#if defined(ESP32)
IPv6Address getIPv6();
IPv6Address getDNSv6(uint8_t idx);
void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info);
#endif
private:
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Stream* debugger;
#endif
NetworkConfig config;
bool connected = false;
bool configChanged = false;
unsigned long timeout = CONNECTION_TIMEOUT;
unsigned long lastRetry = 0;
int8_t ethPowerPin = -1;
uint8_t ethEnablePin = 0;
};
#endif

View File

@@ -0,0 +1,54 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _WIFIACCESSPOINTCONNECTIONHANDLER_H
#define _WIFIACCESSPOINTCONNECTIONHANDLER_H
#include "ConnectionHandler.h"
#include <Arduino.h>
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#include <DNSServer.h>
class WiFiAccessPointConnectionHandler : public ConnectionHandler {
public:
#if defined(AMS_REMOTE_DEBUG)
WiFiAccessPointConnectionHandler(RemoteDebug* debugger);
#else
WiFiAccessPointConnectionHandler(Stream* debugger);
#endif
bool connect(NetworkConfig config, SystemConfig sys);
void disconnect(unsigned long reconnectDelay);
bool isConnected();
bool isConfigChanged();
void getCurrentConfig(NetworkConfig& networkConfig);
IPAddress getIP();
IPAddress getSubnetMask();
IPAddress getGateway();
IPAddress getDns(uint8_t idx);
#if defined(ESP32)
IPv6Address getIPv6();
IPv6Address getDNSv6(uint8_t idx);
void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info);
#endif
private:
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Stream* debugger;
#endif
NetworkConfig config;
DNSServer dnsServer;
bool connected = false;
bool configChanged = false;
};
#endif

View File

@@ -0,0 +1,66 @@
/**
* @copyright Utilitech AS 2023
* License: Fair Source
*
*/
#ifndef _WIFICLIENTCONNECTIONHANDLER_H
#define _WIFICLIENTCONNECTIONHANDLER_H
#include "ConnectionHandler.h"
#include <Arduino.h>
#if defined(AMS_REMOTE_DEBUG)
#include "RemoteDebug.h"
#endif
#define CONNECTION_TIMEOUT 30000
#define RECONNECT_TIMEOUT 5000
#if defined(ESP32)
esp_err_t set_esp_interface_ip(esp_interface_t interface, IPAddress local_ip=INADDR_NONE, IPAddress gateway=INADDR_NONE, IPAddress subnet=INADDR_NONE, IPAddress dhcp_lease_start=INADDR_NONE);
#endif
class WiFiClientConnectionHandler : public ConnectionHandler {
public:
#if defined(AMS_REMOTE_DEBUG)
WiFiClientConnectionHandler(RemoteDebug* debugger);
#else
WiFiClientConnectionHandler(Stream* debugger);
#endif
bool connect(NetworkConfig config, SystemConfig sys);
void disconnect(unsigned long reconnectDelay);
bool isConnected();
bool isConfigChanged();
void getCurrentConfig(NetworkConfig& networkConfig);
IPAddress getIP();
IPAddress getSubnetMask();
IPAddress getGateway();
IPAddress getDns(uint8_t idx);
#if defined(ESP32)
IPv6Address getIPv6();
IPv6Address getDNSv6(uint8_t idx);
void eventHandler(WiFiEvent_t event, WiFiEventInfo_t info);
#endif
private:
#if defined(AMS_REMOTE_DEBUG)
RemoteDebug* debugger;
#else
Stream* debugger;
#endif
NetworkConfig config;
bool busPowered = false;
bool firstConnect = true;
bool configChanged = false;
unsigned long timeout = CONNECTION_TIMEOUT;
unsigned long lastRetry = 0;
wl_status_t begin(const char* ssid, const char* psk);
#if defined(ESP32)
void wifi_sta_config(wifi_config_t * wifi_config, const char * ssid=NULL, const char * password=NULL, const uint8_t * bssid=NULL, uint8_t channel=0, wifi_auth_mode_t min_security=WIFI_AUTH_WPA2_PSK, wifi_scan_method_t scan_method=WIFI_ALL_CHANNEL_SCAN, wifi_sort_method_t sort_method=WIFI_CONNECT_AP_BY_SIGNAL, uint16_t listen_interval=0, bool pmf_required=false);
#endif
};
#endif

Some files were not shown because too many files have changed in this diff Show More