-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDiscovergyMeter.html
152 lines (141 loc) · 6.4 KB
/
DiscovergyMeter.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<script type="text/javascript">
RED.nodes.registerType('discovergy-config',{
category: 'config',
defaults: {
name: {
value: "",
required: false
}
},
credentials: {
username: {type: "text"},
password: {type: "password"}
},
label: function() {
return this.name ? this.name : "Discovergy Meter";
}
});
</script>
<script type="text/x-red" data-template-name="discovergy-config">
<div class="form-row">
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="node-red:common.label.name"></span></label>
<input type="text" id="node-config-input-name">
</div>
<div class="form-row">
<label for="node-config-input-username"><i class="fa fa-user"></i> <span data-i18n="node-red:common.label.username"></span></label>
<input type="text" id="node-config-input-username">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="node-red:common.label.password"></span></label>
<input type="password" id="node-config-input-password">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('Discovergy Meter',{
category: 'Corrently',
color: '#D7D7A0',
defaults: {
name: {value: null},
account: {required:true, type:"discovergy-config"},
meterId: {value: null,required:true},
firstReading: {value: 0,required:true},
firstReadingOut: {value: 0,required:true},
firstReadingDate: {value: null,required:false},
isProduction: {value: false,required:true},
revenue: {value: 0,required:true},
amortization: {value: 0,required:true},
prodMeterId: {value: null,required:false},
firstReadingProd: {value: 0,required:true}
},
inputs:1,
outputs:1,
icon: "font-awesome/fa-dashboard",
label: function() {
return this.name||"DiscovergyMeter";
},
oneditprepare: async function () {
var node = this;
$.get('discovergy/meters?account='+node.account).done( function(data) {
var meters = JSON.parse(data);
for(let i=0;i<meters.length;i++) {
$('#node-input-meterId').append('<option value="' + meters[i].meterId + '">' + meters[i].fullSerialNumber + '</option>').val(node.meterId);
$('#node-input-prodMeterId').append('<option value="' + meters[i].meterId + '">' + meters[i].fullSerialNumber + '</option>').val(node.prodMeterId);
}
});
return;
}
});
</script>
<script type="text/x-red" data-template-name="Discovergy Meter">
<div class="form-row">
<label for="node-input-account"><i class="fa fa-key"></i>Credentials</label>
<input type="text" id="node-input-account">
</div>
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name">
</div>
<div class="form-row">
<label for="node-input-meterId"><i class="icon-tag"></i> Meter</label>
<select id="node-input-meterId" name="node-input-meterId" style="width: 250px;"></select>
</div>
<hr/>
<div class="form-row">
<label for="node-input-firstReadingDate"><i class="icon-tag"></i> First Reading Date (overwrite)</label>
<input type="text" id="node-input-firstReadingDate" name="node-input-firstReadingDate" placeholder="2020-01-31">
</div>
<div class="form-row">
<label for="node-input-firstReading"><i class="icon-tag"></i> First Reading Energy (wh)</label>
<input type="text" id="node-input-firstReading" name="node-input-firstReading">
</div>
<div class="form-row">
<label for="node-input-firstReadingOut"><i class="icon-tag"></i> First Reading EnergyOut (wh)</label>
<input type="text" id="node-input-firstReadingOut" name="node-input-firstReadingOut">
</div>
<div class="form-row">
<label for="node-input-isProduction"><i class="icon-tag"></i> full Production to Grid (Messkonzept 1 ansonsten 2)</label>
<input type="checkbox" id="node-input-isProduction" name="node-input-isProduction">
</div>
<div class="form-row">
<label for="node-input-prodMeterId"><i class="icon-tag"></i> Production Meter</label>
<select id="node-input-prodMeterId" name="node-input-prodMeterId" style="width: 250px;"></select>
</div>
<div class="form-row">
<label for="node-input-firstReadingProd"><i class="icon-tag"></i> First Reading Production (wh)</label>
<input type="text" id="node-input-firstReadingProd" name="node-input-firstReadingProd">
</div>
<div class="form-row">
<label for="node-input-revenue"><i class="icon-tag"></i> revenue per kWh (Generation)</label>
<input type="number" id="node-input-revenue" name="node-input-revenue" placeholder="(0.12)">
</div>
<div class="form-row">
<label for="node-input-amortization"><i class="icon-tag"></i> amortization per year</label>
<input type="number" id="node-input-amortization" name="node-input-amortization" placeholder="(2500)">
</div>
</script>
<script type="text/x-red" data-help-name="Discovergy Meter">
<p>Allows to use a Discovergy Meter with its readings to calculate measurements within the <a href="https://www.corrently.de/">Corrently Ecosystem</a>.</p>
<h3>Output (Standard)</h3>
<code>
msg.payload = {
time: <TIME>, // time of reading per Discovergy API
latest: {
power: <POWERVALUE>,
power1: <POWERVALUE>,
power2: <POWERVALUE>,
power3: <POWERVALUE>,
energy: <ENERGYVALUE>,
energyOut: <ENERGYVALUE>,
baseCosts: <EUROVALUE>,
energyCost: <EUROVALUE>,
energyRevenue: <EUROVALUE>,
incomeSaldo: <EUROVALUE>
}
}
</code>
<h3>Online Support</h3>
<p>
You might reach out online using <a href="https://tawk.to/chat/5c53189451410568a109843f/default" target="_blank">our chat</a>,
Or refer to the <a href="https://github.com/energychain/node-red-contrib-discovergy-meter">Github Repository</a>.
</p>
</script>