Skip to content

Commit

Permalink
Addons (#7)
Browse files Browse the repository at this point in the history
* adding additional queries to fronius api

Signed-off-by: Martin Buchleitner <[email protected]>

* audit fix

Signed-off-by: Martin Buchleitner <[email protected]>

* update deps

Signed-off-by: Martin Buchleitner <[email protected]>
  • Loading branch information
mabunixda authored Oct 15, 2020
1 parent cb4d10d commit 160c135
Show file tree
Hide file tree
Showing 5 changed files with 713 additions and 581 deletions.
4 changes: 3 additions & 1 deletion fronius/fronius.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<select id="node-input-querytype">
<option value="inverter">Inverter Data</option>
<option value="powerflow">Powerflow Data</option>
<option value="storage">Storage Data</option>
<option value="powermeter">Powermeter Data</option>
</select>
</div>
<input type="hidden" id="node-input-name" placeholder="Name">
Expand Down Expand Up @@ -91,7 +93,7 @@
<option>0</option>
<option>1</option>
</select>
</div>
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('fronius-inverter', {
Expand Down
22 changes: 22 additions & 0 deletions fronius/fronius.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,28 @@ module.exports = function(RED) {
}).catch(function(e) {
node.setNodeStatus('red', e);
});
} else if (node.querytype === 'storage') {
fronius.GetStorageRealtimeData(node.options).then(function(json) { // eslint-disable-line
if (!node.isValidHead(json)) {
node.setNodeStatus('orange', json.Head.Status.UserMessage);
return;
}
msg.payload = json.Body.Data;
node.send(msg);
}).catch(function(e) {
node.setNodeStatus('red', e);
});
} else if (node.querytype === 'powermeter') {
fronius.GetPowerMeterRealtimeData(node.options).then(function(json) { // eslint-disable-line
if (!node.isValidHead(json)) {
node.setNodeStatus('orange', json.Head.Status.UserMessage);
return;
}
msg.payload = json.Body.Data;
node.send(msg);
}).catch(function(e) {
node.setNodeStatus('red', e);
});
} else {
node.setNodeStatus('orange', 'could not process query of ' +
node.querytype);
Expand Down
Loading

0 comments on commit 160c135

Please sign in to comment.