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:
Andreas Linde 2022-10-13 13:57:15 +02:00 • committed by GitHub
parent ebf53d154d
commit d408767b2d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 39 additions and 1 deletions

View file

@ -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

View file

@ -68,6 +68,9 @@
"type": "string",
"enum": ["charge", "grid", "pv", "battery"]
}
},
"allinone": {
"type": "boolean"
}
},
"required": [

View file

@ -4,6 +4,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -9,6 +9,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
render: |
type: custom

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: modbus
choice: ["tcpip"]
render: |

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
render: |
type: custom

View file

@ -12,6 +12,7 @@ linked:
params:
- name: usage
choice: ["pv", "battery"]
allinone: true
- name: modbus
choice: ["tcpip"]
id: 71

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: registration
required: true

View file

@ -5,6 +5,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: password
mask: true

View file

@ -5,6 +5,7 @@ products:
params:
- name: usage
choice: ["grid", "pv"]
allinone: true
- name: modbus
choice: ["tcpip"]
render: |

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
render: |
type: rct

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
render: |
type: custom

View file

@ -12,6 +12,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -7,6 +7,7 @@ products:
params:
- name: usage
choice: ["pv", "battery"]
allinone: true
- name: modbus
choice: ["tcpip"]
port: 502

View file

@ -10,6 +10,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -7,6 +7,7 @@ products:
params:
- name: usage
choice: ["grid", "pv"]
allinone: true
- name: modbus
choice: ["tcpip"]
id: 1

View file

@ -13,6 +13,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: modbus
choice: ["tcpip"]
id: 1

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 8080

View file

@ -10,6 +10,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
render: |
type: custom

View file

@ -17,6 +17,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: tokenid
required: true
description:

View file

@ -10,6 +10,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: modbus
choice: ["rs485", "tcpip"]
baudrate: 19200

View file

@ -7,6 +7,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 8080

View file

@ -11,6 +11,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: modbus
choice: ["rs485", "tcpip"]
baudrate: 9600

View file

@ -10,6 +10,7 @@ requirements:
params:
- name: usage
choice: ["grid", "pv"]
allinone: true
- name: modbus
choice: ["rs485", "tcpip"]
baudrate: 9600

View file

@ -8,6 +8,7 @@ group: generic
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: modbus
choice: ["tcpip"]
- name: integer

View file

@ -7,6 +7,7 @@ group: generic
params:
- name: usage
choice: ["grid", "pv"]
allinone: true
- name: modbus
choice: ["tcpip"]
- name: integer

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: password
required: true

View file

@ -7,6 +7,7 @@ products:
params:
- name: usage
choice: ["grid", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -7,6 +7,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -6,6 +6,7 @@ products:
params:
- name: usage
choice: ["grid", "pv", "battery"]
allinone: true
- name: host
- name: port
default: 502

View file

@ -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

View file

@ -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