Configure: fix handling of PV systems (#4806)
- The configure intents to present devices that implement multiple usages in a single device or have linked templates and provide an easier step by step configuration experience e.g. by not asking for the same data for different usages over and over again
- Commit 880557594f changes this behaviour and now presents all devices that have multiple usages, e.g. meters that could be used as battery or pv meter
- This change introduces a new property `allineone` that should be used with the `usage` `param` the identify a device that implements multiple usages in the same device
- The filter to present these devices is extended by checking for this property
This commit is contained in:
parent
ebf53d154d
commit
d408767b2d
34 changed files with 39 additions and 1 deletions
|
|
@ -119,6 +119,10 @@ Example Use Case: With SMA Home Manager, there can be a SMA Energy Meter used fo
|
|||
- `usage`: specifies a list of meter classes, the device can be used for. Possible values are `grid`, `pv`, `battery`, and `charger`
|
||||
- `modbus`: specifies that this device is accessed via modbus. It requires the `choice` property to have a list of possible interface values the device provides. These values can be `rs485` and `tcpip`. The command will use either to ask the appropriate questions and settings. The `render` section needs to include the string `{{include "modbus" .}}` in all places where the configuration needs modbus settings.
|
||||
|
||||
#### Usage Options
|
||||
|
||||
- `allineone`: Defines if the different usages are all available in a single device. Enables `guidedsetup` mode.
|
||||
|
||||
#### Modbus Options
|
||||
|
||||
- `id`: Device specific default for modbus ID
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@
|
|||
"type": "string",
|
||||
"enum": ["charge", "grid", "pv", "battery"]
|
||||
}
|
||||
},
|
||||
"allinone": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
render: |
|
||||
type: custom
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
render: |
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
render: |
|
||||
type: custom
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ linked:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
id: 71
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: registration
|
||||
required: true
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: password
|
||||
mask: true
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
render: |
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
render: |
|
||||
type: rct
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
render: |
|
||||
type: custom
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
port: 502
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
id: 1
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
id: 1
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 8080
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
render: |
|
||||
type: custom
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: tokenid
|
||||
required: true
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["rs485", "tcpip"]
|
||||
baudrate: 19200
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 8080
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["rs485", "tcpip"]
|
||||
baudrate: 9600
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ requirements:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["rs485", "tcpip"]
|
||||
baudrate: 9600
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ group: generic
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
- name: integer
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ group: generic
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv"]
|
||||
allinone: true
|
||||
- name: modbus
|
||||
choice: ["tcpip"]
|
||||
- name: integer
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: password
|
||||
required: true
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ products:
|
|||
params:
|
||||
- name: usage
|
||||
choice: ["grid", "pv", "battery"]
|
||||
allinone: true
|
||||
- name: host
|
||||
- name: port
|
||||
default: 502
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ type Template struct {
|
|||
// GuidedSetupEnabled returns true if there are linked templates or >1 usage
|
||||
func (t *Template) GuidedSetupEnabled() bool {
|
||||
_, p := t.ParamByName(ParamUsage)
|
||||
return len(t.Linked) > 0 || len(p.Choice) > 1
|
||||
return len(t.Linked) > 0 || (len(p.Choice) > 1 && p.AllInOne)
|
||||
}
|
||||
|
||||
// UpdateParamWithDefaults adds default values to specific param name entries
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ type Param struct {
|
|||
ValueType string // string representation of the value type, "string" is default
|
||||
ValidValues []string // list of valid values the user can provide
|
||||
Choice []string // defines a set of choices, e.g. "grid", "pv", "battery", "charge" for "usage"
|
||||
AllInOne bool // defines if the defined usages can all be present in a single device
|
||||
Requirements Requirements // requirements for this param to be usable, only supported via ValueType "bool"
|
||||
|
||||
Baudrate int // device specific default for modbus RS485 baudrate
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue