Skip to content

Commit

Permalink
Merge pull request #217 from phifogg/dev
Browse files Browse the repository at this point in the history
Update Master to 0.11.5
  • Loading branch information
phifogg authored Jan 2, 2025
2 parents dd08f77 + 8f00d7e commit 282ad03
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 105 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ In the instance configuration choose the tab 'Listener' and set the following:
- Path: Enter the same path as in the WS View app
- Forward URL: If you want to forward the received data to another consumer you can specify an additional adress. E.g. you may receive data in WU format and still want to forward this to WeatherUnderground.

*Note*: The forwarding URL needs to end with a trailing question mark (?). Example: https://weatherstation.wunderground.com/weatherstation/updateweatherstation.php?

Save.
The listener will start and wait on incoming connections. Based on your interval you should see in the log a message ' Listener received update: ...' with the data.

Expand All @@ -75,6 +77,8 @@ Save.

The schheduler will start and connect to the weather station after the first interval time. You should see message in the log like 'Scheduler pulling for new data'. If you set the log mode to debug you will also see the data strings received.



## Station specific infos

### Froggit DP1500
Expand All @@ -94,6 +98,8 @@ Station does not answer to scheduler commands, so only listener mode is supporte

Latest version

#### 0.11.5 ECOWITT forwarding fixed

#### 0.11.4 Fix yearlyrain max value and mapping for CO2 sensors

#### 0.10.5 Bugfix for state initialization, removed log messages for forwarding
Expand Down
6 changes: 5 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"common": {
"name": "sainlogic",
"version": "0.11.4",
"version": "0.11.5",
"news": {
"0.11.5": {
"en": "Fix forwarding ECOWITT protocoll",
"de": "Ecowitt Forwarding korrigiert"
},
"0.11.4": {
"en": "Fix yearlyrain max value and mapping for CO2 sensors",
"de": "Max. Wert für Yearlyrain korrigiert, CO2 Sensorenmapping korrigiert"
Expand Down
28 changes: 14 additions & 14 deletions lib/listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,21 @@ class Listener {
//this.adapter.setStateAsync('info.last_listener_update', { val: JSON.stringify(json_response), ack: true });
response.end('ok');
this.adapter.setStates(new Date(), this.extract_values(json_response));

});


if (this.forward_url != null && this.forward_url != '') {
// forward to another host
const fwd_url = new URL(this.forward_url);

got(fwd_url, { method: 'POST', retry: {limit: 0} , body: my_body }).then(got_response => {
this.adapter.log.debug('Forward URL: + ' + got_response.requestUrl);
this.adapter.log.debug('Forward response body: ' + got_response.body);
}).catch(error => {
this.adapter.log.info(error);
});
}
// forwarding needs to happen when request is complete, otherwise we send empty payload
if (this.forward_url != null && this.forward_url != '') {
// forward to another host
const fwd_url = new URL(this.forward_url);

got(fwd_url, { method: 'POST', retry: {limit: 0} , body: my_body }).then(got_response => {
this.adapter.log.debug('Forward URL: + ' + got_response.requestUrl);
this.adapter.log.debug('Forward response body: ' + got_response.body);
}).catch(error => {
this.adapter.log.info(error);
});
}

});

} else {
this.adapter.log.warn(`Listener received illegal request: (${request.method}) ${request.url}`);
Expand Down
160 changes: 72 additions & 88 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 282ad03

Please # to comment.