Skip to content

Commit 1bfa8be

Browse files
committed
more debug output & readme edited
1 parent 42a3b29 commit 1bfa8be

2 files changed

Lines changed: 9 additions & 82 deletions

File tree

README.md

Lines changed: 4 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -14,87 +14,13 @@
1414

1515
Reads data from the SofarCloud server
1616

17-
## Developer manual
18-
This section is intended for the developer. It can be deleted later.
19-
20-
### DISCLAIMER
21-
22-
Please make sure that you consider copyrights and trademarks when you use names or logos of a company and add a disclaimer to your README.
23-
You can check other adapters for examples or ask in the developer community. Using a name or logo of a company without permission may cause legal problems for you.
24-
25-
### Getting started
26-
27-
You are almost done, only a few steps left:
28-
1. Clone the repository from GitHub to a directory on your PC:
29-
```bash
30-
git clone https://github.com/ltspicer/ioBroker.sofarcloud
31-
```
32-
33-
1. Head over to [main.js](main.js) and start programming!
34-
35-
### Best Practices
36-
We've collected some [best practices](https://github.com/ioBroker/ioBroker.repositories#development-and-coding-best-practices) regarding ioBroker development and coding in general. If you're new to ioBroker or Node.js, you should
37-
check them out. If you're already experienced, you should also take a look at them - you might learn something new :)
38-
39-
### Scripts in `package.json`
40-
Several npm scripts are predefined for your convenience. You can run them using `npm run <scriptname>`
41-
| Script name | Description |
42-
|-------------|-------------|
43-
| `test:js` | Executes the tests you defined in `*.test.js` files. |
44-
| `test:package` | Ensures your `package.json` and `io-package.json` are valid. |
45-
| `test:integration` | Tests the adapter startup with an actual instance of ioBroker. |
46-
| `test` | Performs a minimal test run on package files and your tests. |
47-
| `check` | Performs a type-check on your code (without compiling anything). |
48-
| `lint` | Runs `ESLint` to check your code for formatting errors and potential bugs. |
49-
| `translate` | Translates texts in your adapter to all required languages, see [`@iobroker/adapter-dev`](https://github.com/ioBroker/adapter-dev#manage-translations) for more details. |
50-
| `release` | Creates a new release, see [`@alcalzone/release-script`](https://github.com/AlCalzone/release-script#usage) for more details. |
51-
52-
### Writing tests
53-
When done right, testing code is invaluable, because it gives you the
54-
confidence to change your code while knowing exactly if and when
55-
something breaks. A good read on the topic of test-driven development
56-
is https://hackernoon.com/introduction-to-test-driven-development-tdd-61a13bc92d92.
57-
Although writing tests before the code might seem strange at first, but it has very
58-
clear upsides.
59-
60-
The template provides you with basic tests for the adapter startup and package files.
61-
It is recommended that you add your own tests into the mix.
62-
63-
### Publishing the adapter
64-
Using GitHub Actions, you can enable automatic releases on npm whenever you push a new git tag that matches the form
65-
`v<major>.<minor>.<patch>`. We **strongly recommend** that you do. The necessary steps are described in `.github/workflows/test-and-release.yml`.
66-
67-
Since you installed the release script, you can create a new
68-
release simply by calling:
69-
```bash
70-
npm run release
71-
```
72-
Additional command line options for the release script are explained in the
73-
[release-script documentation](https://github.com/AlCalzone/release-script#command-line).
74-
75-
To get your adapter released in ioBroker, please refer to the documentation
76-
of [ioBroker.repositories](https://github.com/ioBroker/ioBroker.repositories#requirements-for-adapter-to-get-added-to-the-latest-repository).
77-
78-
### Test the adapter manually with dev-server
79-
Please use `dev-server` to test and debug your adapter.
80-
81-
You may install and start `dev-server` by calling from your dev directory:
82-
```bash
83-
npm install --global @iobroker/dev-server
84-
dev-server setup
85-
dev-server watch
86-
```
87-
88-
Please refer to the [`dev-server` documentation](https://github.com/ioBroker/dev-server#readme) for more details.
8917

9018
## Changelog
91-
<!--
92-
Placeholder for the next version (at the beginning of the line):
93-
### **WORK IN PROGRESS**
94-
-->
19+
9520

9621
### **WORK IN PROGRESS**
97-
* (Daniel Luginbühl) initial release
22+
- Initial release
23+
9824

9925
## License
10026
MIT License
@@ -117,4 +43,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
11743
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
11844
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11945
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
120-
SOFTWARE.
46+
SOFTWARE.

main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class SofarCloud extends utils.Adapter {
120120
return null;
121121
}
122122

123-
// Stationen abfragen
123+
// Stationen (Inverter) abfragen
124124
async getSofarStationData(token) {
125125
const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
126126
const URL = "https://global.sofarcloud.com/api/";
@@ -159,7 +159,7 @@ class SofarCloud extends utils.Adapter {
159159
}
160160
}
161161

162-
// Datenpunkte für eine Station anlegen/aktualisieren
162+
// Datenpunkte für eine Station (Inverter) anlegen/aktualisieren
163163
async createOrUpdateStationDPs(station, idx) {
164164
if (!station) return;
165165

@@ -173,7 +173,7 @@ class SofarCloud extends utils.Adapter {
173173

174174
// Für jedes Feld im station-Objekt einen State anlegen
175175
for (const [key, value] of Object.entries(station)) {
176-
// Optional: bestimmte Felder überspringen
176+
// Bestimmte Felder überspringen
177177
if (typeof value === "object" || key.toLowerCase().endsWith("unit")) continue;
178178

179179
// Einheit suchen, falls vorhanden
@@ -210,7 +210,7 @@ class SofarCloud extends utils.Adapter {
210210
try {
211211
const filePath = path.join(dir || __dirname, filename);
212212
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
213-
this.log.debug(`JSON gespeichert: ${filePath}`);
213+
this.log.debug(`JSON saved: ${filePath}`);
214214
} catch (e) {
215215
this.log.error("Error saving JSON: " + e.message);
216216
}
@@ -227,6 +227,7 @@ class SofarCloud extends utils.Adapter {
227227
}
228228
}
229229
}
230+
this.log.debug("MQTT data sent");
230231
}
231232

232233
onUnload(callback) {

0 commit comments

Comments
 (0)