Lambda: support for excess energy specified in negative numbers (#21972)
This commit is contained in:
parent
18d071f7c3
commit
72b64d038d
2 changed files with 16 additions and 3 deletions
|
|
@ -16,17 +16,24 @@ requirements:
|
|||
Energiemanagementeinstellungen am Gerät:
|
||||
|
||||
- E-Meter Kommunikationsart: "ModBus Client"
|
||||
- E-Meter Messpunkt: "Pos. E-Überschuss"
|
||||
- E-Meter Messpunkt: "Pos. E-Überschuss" oder "Neg. E-Überschuss"
|
||||
en: |
|
||||
Energy management settings of the device:
|
||||
|
||||
- E-Meter communication type: "ModBus Client"
|
||||
- E-Meter measuring point: "Pos. E-Überschuss"
|
||||
- E-Meter measuring point: "Pos. Excess Energy" or "Neg. Excess Energy"
|
||||
params:
|
||||
- name: host
|
||||
- name: tempsource
|
||||
type: choice
|
||||
choice: ["warmwater_top", "warmwater_bottom", "buffer_top", "buffer_bottom"]
|
||||
- name: excess
|
||||
type: choice
|
||||
choice: ["plus", "minus"]
|
||||
default: "plus"
|
||||
description:
|
||||
de: E-Überschuss ("plus" oder "minus")
|
||||
en: Excess Energy ("plus" or "minus")
|
||||
- name: phases
|
||||
deprecated: true
|
||||
- name: watchdog
|
||||
|
|
@ -47,6 +54,7 @@ render: |
|
|||
address: 102 # PV Überschussleistung
|
||||
type: writemultiple # λ erwartet single value als FC16
|
||||
decode: int16
|
||||
scale: {{ if eq .excess "plus" }}1{{ else }}-1{{ end }}
|
||||
power:
|
||||
source: modbus
|
||||
uri: {{ .host }}:502
|
||||
|
|
|
|||
|
|
@ -178,7 +178,12 @@ func (r Register) EncodeFunc() (func(float64) ([]byte, error), error) {
|
|||
case strings.HasPrefix(enc, "bool"):
|
||||
fallthrough
|
||||
|
||||
case strings.HasPrefix(enc, "int") || strings.HasPrefix(enc, "uint"):
|
||||
case strings.HasPrefix(enc, "int"):
|
||||
return r.encodeToBytes(func(v float64) uint64 {
|
||||
return uint64(int64(v))
|
||||
})
|
||||
|
||||
case strings.HasPrefix(enc, "uint"):
|
||||
return r.encodeToBytes(func(v float64) uint64 {
|
||||
return uint64(v)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue