Skip to content

Commit 3723d5b

Browse files
committed
ci: add tests
1 parent f087d3c commit 3723d5b

7 files changed

Lines changed: 195 additions & 40 deletions

File tree

‎.github/workflows/build-ci.yaml‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
schedule:
9+
- cron: "0 8 * * *"
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
13+
cancel-in-progress: true
14+
15+
jobs:
16+
build-ci:
17+
name: Building opendtu_sdm630_ci / ${{ matrix.esphome-version }}
18+
runs-on: ubuntu-latest
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
esphome-version:
23+
- stable
24+
steps:
25+
- name: Checkout source code
26+
uses: actions/checkout@v4
27+
28+
- name: Create secrets.yaml
29+
run: cp secrets.yaml.example tests/secrets.yaml
30+
31+
- name: ESPHome ${{ matrix.esphome-version }}
32+
uses: esphome/build-action@v7
33+
with:
34+
yaml-file: tests/opendtu_sdm630_ci.yaml
35+
version: ${{ matrix.esphome-version }}

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/.esphome/
22
/secrets.yaml
3+
/tests/secrets.yaml
34

45
/.vscode/
56
/.cursor/

‎LICENSE‎

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
1+
12
Apache License
23
Version 2.0, January 2004
34
http://www.apache.org/licenses/
45

5-
Copyright 2026 Lewa-Reka <lewareka.yt@gmail.com>
6-
7-
Licensed under the Apache License, Version 2.0 (the "License");
8-
you may not use this file except in compliance with the License.
9-
You may obtain a copy of the License at
10-
11-
http://www.apache.org/licenses/LICENSE-2.0
12-
13-
Unless required by applicable law or agreed to in writing, software
14-
distributed under the License is distributed on an "AS IS" BASIS,
15-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16-
See the License for the specific language governing permissions and
17-
limitations under the License.
18-
196
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
207

218
1. Definitions.
@@ -106,33 +93,33 @@
10693
meet the following conditions:
10794

10895
(a) You must give any other recipients of the Work or
109-
Derivative Works a copy of this License; and
96+
Derivative Works a copy of this License; and
11097

11198
(b) You must cause any modified files to carry prominent notices
112-
stating that You changed the files; and
99+
stating that You changed the files; and
113100

114101
(c) You must retain, in the Source form of any Derivative Works
115-
that You distribute, all copyright, patent, trademark, and
116-
attribution notices from the Source form of the Work,
117-
excluding those notices that do not pertain to any part of
118-
the Derivative Works; and
102+
that You distribute, all copyright, patent, trademark, and
103+
attribution notices from the Source form of the Work,
104+
excluding those notices that do not pertain to any part of
105+
the Derivative Works; and
119106

120107
(d) If the Work includes a "NOTICE" text file as part of its
121-
distribution, then any Derivative Works that You distribute must
122-
include a readable copy of the attribution notices contained
123-
within such NOTICE file, excluding those notices that do not
124-
pertain to any part of the Derivative Works, in at least one
125-
of the following places: within a NOTICE text file distributed
126-
as part of the Derivative Works; within the Source form or
127-
documentation, if provided along with the Derivative Works; or,
128-
within a display generated by the Derivative Works, if and
129-
wherever such third-party notices normally appear. The contents
130-
of the NOTICE file are for informational purposes only and
131-
do not modify the License. You may add Your own attribution
132-
notices within Derivative Works that You distribute, alongside
133-
or as an addendum to the NOTICE text from the Work, provided
134-
that such additional attribution notices cannot be construed
135-
as modifying the License.
108+
distribution, then any Derivative Works that You distribute must
109+
include a readable copy of the attribution notices contained
110+
within such NOTICE file, excluding those notices that do not
111+
pertain to any part of the Derivative Works, in at least one
112+
of the following places: within a NOTICE text file distributed
113+
as part of the Derivative Works; within the Source form or
114+
documentation, if provided along with the Derivative Works; or,
115+
within a display generated by the Derivative Works, if and
116+
wherever such third-party notices normally appear. The contents
117+
of the NOTICE file are for informational purposes only and
118+
do not modify the License. You may add Your own attribution
119+
notices within Derivative Works that You distribute, alongside
120+
or as an addendum to the NOTICE text from the Work, provided
121+
that such additional attribution notices cannot be construed
122+
as modifying the License.
136123

137124
You may add Your own copyright statement to Your modifications and
138125
may provide additional or different license terms and conditions
@@ -200,7 +187,7 @@
200187
same "printed page" as the copyright notice for easier
201188
identification within third-party archives.
202189

203-
Copyright 2026 Lewa-Reka <lewareka.yt@gmail.com>
190+
Copyright [yyyy] [name of copyright owner]
204191

205192
Licensed under the Apache License, Version 2.0 (the "License");
206193
you may not use this file except in compliance with the License.

‎NOTICE‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
================================================================================
2+
ESPHome OpenDTU to SDM630
3+
Copyright 2026 Lewa-Reka <lewareka.yt@gmail.com>
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
================================================================================
17+
18+
This project provides an ESPHome external component that bridges OpenDTU
19+
microinverter data to a Modbus RTU Eastron SDM630 energy meter emulator.
20+
21+
Project Repository: https://github.com/Lewa-Reka/esphome-opendtu-to-sdm630
22+
23+
================================================================================
24+
This project is built upon the ESPHome platform.
25+
ESPHome is a framework for controlling ESP8266/ESP32 devices.
26+
Copyright (c) 2019 ESPHome
27+
28+
The ESPHome platform is distributed under a dual-license model:
29+
- The Python codebase and other parts are under the MIT License.
30+
- The C++/runtime codebase is under the GNU GENERAL PUBLIC LICENSE v3.0.
31+
32+
For more information, please visit the ESPHome project:
33+
https://esphome.io/
34+
https://github.com/esphome/esphome
35+
================================================================================

‎README.md‎

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
# ESPHome OpenDTU to SDM630 Component
22

3-
[![License](https://img.shields.io/github/license/Lewa-Reka/esphome-opendtu-to-sdm630)](LICENSE)
4-
[![OpenDTU](https://img.shields.io/badge/requires-OpenDTU-2E7D32)](https://github.com/tbnobody/OpenDTU)
3+
<!--
4+
SPDX-License-Identifier: Apache-2.0
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
-->
18+
19+
![Maintenance](https://img.shields.io/maintenance/yes/2026?style=for-the-badge)
20+
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/Lewa-Reka/esphome-opendtu-to-sdm630/build-ci.yaml?style=for-the-badge)
21+
![GitHub License](https://img.shields.io/github/license/Lewa-Reka/esphome-opendtu-to-sdm630?style=for-the-badge)
22+
![GitHub commit activity](https://img.shields.io/github/commit-activity/y/Lewa-Reka/esphome-opendtu-to-sdm630?style=for-the-badge)
523

624
ESPHome external component that bridges [OpenDTU](https://github.com/tbnobody/OpenDTU) microinverter data to a Modbus RTU **Eastron SDM630** energy meter emulator.
725

@@ -147,7 +165,7 @@ All options under `opendtu_sdm630:`:
147165

148166
Each entry requires `grid_phase` (`1` = L1, `2` = L2, `3` = L3) and **exactly one** identifier:
149167

150-
- `serial` — microinverter serial from OpenDTU livedata (`inverters[].serial`); stable if you rename the inverter in OpenDTU
168+
- `serial` - microinverter serial from OpenDTU livedata (`inverters[].serial`); stable if you rename the inverter in OpenDTU
151169
- `name` - microinverter name from OpenDTU livedata (`inverters[].name`)
152170

153171
`serial` and `name` cannot be used in the same entry.
@@ -282,4 +300,26 @@ OTA updates work through the ESPHome dashboard or `esphome upload` over the netw
282300

283301
## License
284302

285-
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for the full text.
303+
This project is licensed under the Apache License 2.0 — see the [LICENSE](LICENSE) file for details.
304+
305+
### Copyright Notice
306+
307+
```
308+
Copyright 2026 Lewa-Reka <lewareka.yt@gmail.com>
309+
310+
Licensed under the Apache License, Version 2.0 (the "License");
311+
you may not use this file except in compliance with the License.
312+
You may obtain a copy of the License at
313+
314+
http://www.apache.org/licenses/LICENSE-2.0
315+
316+
Unless required by applicable law or agreed to in writing, software
317+
distributed under the License is distributed on an "AS IS" BASIS,
318+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
319+
See the License for the specific language governing permissions and
320+
limitations under the License.
321+
```
322+
323+
### Third-Party Components
324+
325+
This project uses ESPHome and related components. Please refer to the [NOTICE](NOTICE) file for additional license information.

‎tests/.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Gitignore settings for ESPHome
2+
# This is an example and may include too much for your use-case.
3+
# You can modify this file to suit your needs.
4+
/.esphome/
5+
/secrets.yaml

‎tests/opendtu_sdm630_ci.yaml‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
substitutions:
2+
device_name: opendtu-sdm630-ci
3+
4+
external_components:
5+
- source:
6+
type: local
7+
path: ../components
8+
components: [opendtu_sdm630]
9+
10+
opendtu_sdm630:
11+
id: opendtu
12+
host: 192.168.1.50
13+
password: !secret opendtu_password
14+
modbus_id: modbus_1
15+
microinverter_map:
16+
- name: test-inverter
17+
grid_phase: 1
18+
19+
esphome:
20+
name: ${device_name}
21+
min_version: "2025.6.0"
22+
23+
esp32:
24+
variant: esp32
25+
framework:
26+
type: esp-idf
27+
28+
logger:
29+
level: INFO
30+
31+
uart:
32+
id: modbus_uart
33+
tx_pin: 17
34+
rx_pin: 16
35+
baud_rate: 9600
36+
parity: NONE
37+
stop_bits: 1
38+
39+
modbus:
40+
id: modbus_1
41+
uart_id: modbus_uart
42+
role: server
43+
44+
api:
45+
46+
ota:
47+
- platform: esphome
48+
password: !secret ota_password
49+
50+
wifi:
51+
ssid: !secret wifi_ssid
52+
password: !secret wifi_password

0 commit comments

Comments
 (0)