@mschaeffler/node-red-bthome 1.6.0 → 1.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +27 -17
  2. package/package.json +1 -1
  3. package/ws90.html +44 -20
  4. package/ws90.js +10 -6
package/README.md CHANGED
@@ -14,7 +14,7 @@ At the moment these sensors are implemented and tested:
14
14
  - Shelly BLU Motion
15
15
  - Shelly BLU Distance
16
16
  - Shelly BLU Remote
17
- - Ecowitt WS90
17
+ - Ecowitt WS90 powered by Shelly
18
18
 
19
19
  ## Capture of Raw Frames
20
20
 
@@ -145,7 +145,9 @@ If content storage is active, statistical data is also stored in a variable with
145
145
 
146
146
  ## ws90 Node
147
147
 
148
- This node does some additional calculations to get more usefull data from the WS90 weather station.
148
+ This node does additional calulations with the data from an "*Ecowitt WS90 powered by Shelly*" weather station.
149
+
150
+ Normally this data is decoded by the `bthome` node.
149
151
 
150
152
  Similar calculations are done by the Ecowitt base stations.
151
153
 
@@ -154,6 +156,8 @@ Similar calculations are done by the Ecowitt base stations.
154
156
  |msg. | type | description |
155
157
  |:-------|:-------|:----------------------------------|
156
158
  |payload |object |data from `bthome` node. |
159
+ |reset |boolean |if set to `true`, the output filter is reset and unchanged values will been sent with the next raw data.|
160
+ |newday |boolean |if set to `true`, a new day is started (rain today, rain yesterday and wind max).|
157
161
 
158
162
  This is an example of such a message payload:
159
163
  ```
@@ -174,22 +178,28 @@ This is an example of such a message payload:
174
178
  ### Outputs
175
179
 
176
180
  There are 12 output ports:
177
- - temperature
178
- - dew point
179
- - humidity
180
- - raining²
181
- - rain yesterday
182
- - rain today
183
- - uv²
184
- - air pressure
185
- - direction
186
- - wind²
187
- - wind max
188
- - illumination
189
-
190
- ²: this values have style classes for the `dashboard 2` attached.
181
+
182
+ values are only sent out, if they are changed
183
+
184
+ | topic | explanation |
185
+ |:------|:------------|
186
+ |temperature|no calculation, value directly from the input data|
187
+ |dew point|no calculation, value directly from the input data|
188
+ |humidity|no calculation, value directly from the input data|
189
+ |raining|Is it raining at the moment?<br>It is set to `true`, if `moisture==true` or a delta in `precipitation` is received.<br>It is set to `false` after a timeout of 15min or 20min without any of the above events.<br>If `true` the class is set to `blueValue`.|
190
+ |rain yesterday|rain from yesterday, at `newday==true` it is taken from `rain today`|
191
+ |rain today|accumulated rain today, so since the last `newday==true` received|
192
+ |uv|no calculation, value directly from the input data<br>between 0 and 2 the class is set to `greenValue`, up to 5 to `yellowValue` and above to `redValue`|
193
+ |air pressure|can be either the measured air pressure (QFE) without any further calculation<br>or the air pressure at sea level (QFF) [for the calculation](https://de.wikipedia.org/wiki/Barometrische_H%C3%B6henformel)|
194
+ |direction|no calculation, value directly from the input data|
195
+ |wind|no calculation, value directly from the input data<br>between 0 and 25 the class is set to default, up to 50 to `yellowValue` and above to `redValue`|
196
+ |wind max|maximal wind speed today, so since the last `newday==true` received|
197
+ |illumination|no calculation, value directly from the input data|
191
198
 
192
199
  #### style classes
200
+
201
+ Some values have style classes for the `dashboard 2` attached.
202
+
193
203
  This classes should be defined (for an example check the `ui-template` in the
194
204
  [examples](https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-bthome/examples/CSS.json)):
195
205
  - greenValue
@@ -202,7 +212,7 @@ This classes should be defined (for an example check the `ui-template` in the
202
212
  |config | type | description |
203
213
  |:------------|:-------|:----------------------------------|
204
214
  |Contextstore | string | context store to be used. |
205
- |reference height|number| height of the installation over the sea level, to caculate the absolute air pressure. |
215
+ |reference height|number| height of the installation over the sea level, to caculate the relative air pressure (QFF).<br>If set to `0` no caclulation is done and the absolute air pressure (QFE) is outputed.|
206
216
 
207
217
  ## Example Flow
208
218
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mschaeffler/node-red-bthome",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "A Node Red node to decrypt and decode BT-Home frames",
5
5
  "author": {
6
6
  "name": "Mathias Schäffler",
package/ws90.html CHANGED
@@ -48,19 +48,24 @@
48
48
  <select type="text" id="node-input-contextStore"></select>
49
49
  </div>
50
50
  <div class="form-row">
51
- <label for="node-input-refheight"><i class="fa fa-"></i> reference height</label>
51
+ <label for="node-input-refheight"><i class="fa fa-level-up"></i> reference height</label>
52
52
  <input type="text" id="node-input-refheight">
53
53
  </div>
54
54
  </script>
55
55
 
56
56
  <script type="text/x-red" data-help-name="ws90">
57
57
 
58
- <p>A Node Red node to work with data from the WS90 weather station.</p>
58
+ <p>A Node Red node to perform additional calulations with the data from an &ldquo;<em>Ecowitt WS90 powered by Shelly</em>&rdquo; weather station.</p>
59
+ <p>Normally this data is decoded by the <code>bthome</code> node.
59
60
 
60
61
  <h3>Input</h3>
61
62
  <dl class="message-properties">
62
63
  <dt>payload <span class="property-type">object</span></dt>
63
- <dd> data from <code>bthome</code> node.</dd>
64
+ <dd> raw data from <code>bthome</code> node.</dd>
65
+ <dt>reset <span class="property-type">boolean</span></dt>
66
+ <dd> if set to <code>true</code>, the output filter is reset and unchanged values will been sent with the next raw data.</dd>
67
+ <dt>newday <span class="property-type">boolean</span></dt>
68
+ <dd> if set to <code>true</code>, a new day is started (rain today, rain yesterday and wind max).</dd>
64
69
  </dl>
65
70
 
66
71
  <p>This is an example of such a message payload:</p>
@@ -78,24 +83,42 @@
78
83
  }</code>
79
84
 
80
85
  <h3>Outputs</h3>
81
- <p>There are 12 output ports:</p>
82
- <ol>
83
- <li>temperature</li>
84
- <li>dew point</li>
85
- <li>humidity</li>
86
- <li>raining²</li>
87
- <li>rain yesterday</li>
88
- <li>rain today</li>
89
- <li>uv²</li>
90
- <li>air pressure</li>
91
- <li>direction</li>
92
- <li>wind²</li>
93
- <li>wind max</li>
94
- <li>illumination</li>
95
- </ol>
96
- <p>²: this values have style classes for the <code>dashboard 2</code> attached.</p>
86
+ <p>There are 12 output ports</p>
87
+ <p>values are only sent out, if they are changed</p>
88
+ <dl>
89
+ <dt>temperature</dt>
90
+ <dd>no calculation, value directly from the input data</dd>
91
+ <dt>dew point</dt>
92
+ <dd>no calculation, value directly from the input data</dd>
93
+ <dt>humidity</dt>
94
+ <dd>no calculation, value directly from the input data</dd>
95
+ <dt>raining</dt>
96
+ <dd>Is it raining at the moment?<br>
97
+ It is set to <code>true</code>, if <code>moisture==true</code> or a delta in <code>precipitation</code> is received.<br>
98
+ It is set to <code>false</code> after a timeout of 15min or 20min without any of the above events.<br>
99
+ If <code>true</code> the class is set to <code>blueValue</code>.</dd>
100
+ <dt>rain yesterday</dt>
101
+ <dd>rain from yesterday, at <code>newday==true</code> it is taken from <code>rain today</code></dd>
102
+ <dt>rain today</dt>
103
+ <dd>accumulated rain today, so since the last <code>newday==true</code> received</dd>
104
+ <dt>uv</dt>
105
+ <dd>no calculation, directly from the input data<br>
106
+ between 0 and 2 the class is set to <code>greenValue</code>, up to 5 to <code>yellowValue</code> and above to <code>redValue</code></dd>
107
+ <dt>air pressure</dt>
108
+ <dd>can be either the measured air pressure (QFE) without any further calculation<br>or the air pressure at sea level (QFF) (<a htref="https://de.wikipedia.org/wiki/Barometrische_H%C3%B6henformel">for the calculation</a>)</dd>
109
+ <dt>direction</dt>
110
+ <dd>no calculation, value directly from the input data</dd>
111
+ <dt>wind</dt>
112
+ <dd>no calculation, value directly from the input data<br>
113
+ between 0 and 25 the class is set to default, up to 50 to <code>yellowValue</code> and above to <code>redValue</code></dd>
114
+ <dt>wind max</dt>
115
+ <dd>maximal wind speed today, so since the last <code>newday==true</code> received</dd>
116
+ <dt>illumination</dt>
117
+ <dd>no calculation, directly from the input data</dd>
118
+ </dl>
97
119
 
98
120
  <h4>style classes</h4>
121
+ <p>Some values have style classes for the <code>dashboard 2</code> attached.<p>
99
122
  <p>This classes should be defined (for an example check the <code>ui-template</code> in the <a href="https://github.com/m-schaeffler/node-red-my-nodes/raw/main/node-red-bthome/examples/CSS.json">examples</a>):<p>
100
123
  <ul>
101
124
  <li>greenValue</li>
@@ -109,7 +132,8 @@
109
132
  <dt>Contextstore <span class="property-type">string</span></dt>
110
133
  <dd> context store to be used.</dd>
111
134
  <dt>reference height <span class="property-type">number</span></dt>
112
- <dd> height of the installation over the sea level, to caculate the absolute air pressure.</dt>
135
+ <dd> height of the installation over the sea level, to caculate the relative air pressure (QFF).
136
+ If set to <code>0</code> no caclulation is done and the absolute air pressure (QFE) is outputed.</dt>
113
137
  </dl>
114
138
 
115
139
  </script>
package/ws90.js CHANGED
@@ -84,10 +84,14 @@ module.exports = function(RED) {
84
84
  const now = Date.now();
85
85
 
86
86
  // Luftdruck https://de.wikipedia.org/wiki/Barometrische_H%C3%B6henformel
87
- //const E = temperature >= 9.1 ? 18.219 * ( 1.0463 - Math.exp( -0.0666 * temperature ) ) : 5.6402 * ( Math.exp( 0.06 * temperature ) - 0.0916 );
88
- const p_H2O = ( 6.112 * Math.exp((17.62 * msg.payload.temperature) / ( msg.payload.temperature + 243.12)) * msg.payload.humidity) / 100; // Partialdruck Wasserdampf https://www.schweizer-fn.de/lueftung/feuchte/feuchte.php
89
- const h = node.refheight; // Ortshöhe
90
- const normdruck = msg.payload.pressure * Math.exp( 9.80665 / ( 287.05 * ( 273.15 + msg.payload.temperature + 0.12 * p_H2O + 0.0065 * h / 2 ) ) * h );
87
+ let luftdruck = msg.payload.pressure;
88
+ if( node.refheight != 0 )
89
+ {
90
+ //const E = temperature >= 9.1 ? 18.219 * ( 1.0463 - Math.exp( -0.0666 * temperature ) ) : 5.6402 * ( Math.exp( 0.06 * temperature ) - 0.0916 );
91
+ const p_H2O = ( 6.112 * Math.exp((17.62 * msg.payload.temperature) / ( msg.payload.temperature + 243.12)) * msg.payload.humidity) / 100; // Partialdruck Wasserdampf https://www.schweizer-fn.de/lueftung/feuchte/feuchte.php
92
+ const h = node.refheight; // Ortshöhe
93
+ luftdruck *= Math.exp( 9.80665 / ( 287.05 * ( 273.15 + msg.payload.temperature + 0.12 * p_H2O + 0.0065 * h / 2 ) ) * h );
94
+ }
91
95
 
92
96
  // Regen
93
97
  let raining = node.storage.Raining;
@@ -130,7 +134,7 @@ module.exports = function(RED) {
130
134
  setStorage( "WindMax", wind );
131
135
  }
132
136
 
133
- node.status( Math.round( normdruck ) );
137
+ node.status( Math.round( luftdruck ) );
134
138
  send( [
135
139
  genMessage( "outside temperature", msg.payload.temperature ),
136
140
  genMessage( "dew point", msg.payload.dewpoint ),
@@ -139,7 +143,7 @@ module.exports = function(RED) {
139
143
  genMessage( "rain yesterday", node.storage.RegenGestern ),
140
144
  genMessage( "rain today", node.storage.RegenHeute, msg.payload.moisture ? "blueValue" : "" ),
141
145
  genMessage( "uv index", msg.payload.uv, ampel( msg.payload.uv, 2, 5, "greenValue" ) ),
142
- genMessage( "air pressure", normdruck ),
146
+ genMessage( "air pressure", luftdruck ),
143
147
  genMessage( "wind direction", msg.payload.direction ),
144
148
  genMessage( "wind", wind, ampel( wind, 25, 50 ) ),
145
149
  genMessage( "wind_max", node.storage.WindMax ),