Révision 520c436c
fronius: support jq builds without math library
"round" is part of jq's math support. Some distros (rhel8) don't enable it.
Fortunately round can be emulated with "floor" which is always present in
modern jq.
| plugins/solar/fronius | ||
|---|---|---|
| 31 | 31 |
|
| 32 | 32 |
=head1 CAVEAT |
| 33 | 33 |
|
| 34 |
Only tested on a Fronius Primo. |
|
| 34 |
Only tested on a Fronius Primo and Fronius Symo.
|
|
| 35 | 35 |
|
| 36 | 36 |
=head1 AUTHOR |
| 37 | 37 |
|
| ... | ... | |
| 180 | 180 |
for CMD in curl jq recode; do |
| 181 | 181 |
if ! command -v "${CMD}" >/dev/null; then
|
| 182 | 182 |
echo "no (${CMD} not found)"
|
| 183 |
exit 0 |
|
| 183 | 184 |
fi |
| 184 | 185 |
done |
| 185 | 186 |
} |
| ... | ... | |
| 261 | 262 |
} |
| 262 | 263 |
|
| 263 | 264 |
get_data() {
|
| 264 |
cached 0 get_power_flow_realtime_data | jq -r '.Body.Data.Inverters |
|
| 265 |
cached 0 get_power_flow_realtime_data | jq -r 'def roundit: . + 0.5 | floor; |
|
| 266 |
.Body.Data.Inverters |
|
| 265 | 267 |
| to_entries[] |
| 266 | 268 |
| @text " |
| 267 |
inverter\(.key).value \(.value.E_Year | round) |
|
| 268 |
inverter\(.key).extinfo Immediate output: \(.value.P) W; Daily total: \(.value.E_Day | round) Wh; Yearly total: \(.value.E_Year / 1000 | round) kWh
|
|
| 269 |
inverter\(.key).value \(.value.E_Year | roundit)
|
|
| 270 |
inverter\(.key).extinfo Immediate output: \(.value.P) W; Daily total: \(.value.E_Day | roundit) Wh; Yearly total: \(.value.E_Year / 1000 | roundit) kWh
|
|
| 269 | 271 |
"' |
| 270 | 272 |
} |
| 271 | 273 |
|
Formats disponibles : Unified diff