Skip to content

Commit 3c06188

Browse files
committed
Add better ui hints
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
1 parent d981e0d commit 3c06188

File tree

10 files changed

+166
-144
lines changed

10 files changed

+166
-144
lines changed

SETTINGS.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Configure your home battery storage system for optimal energy management and cos
112112
| `name` | string | Yes || Battery name/identifier |
113113
| `entity actual level` | string | Yes || HA entity for current battery SOC (Unit: `%`) |
114114
| `capacity` | number | Yes || Battery capacity in kWh (Unit: `kWh`) _Must be greater than 0_ |
115-
| `upper limit` | integer or [FlexValue](#flexvalue) | Yes | — | Maximum SOC % (can be HA entity) |
115+
| `upper limit` | integer or [FlexValue](#flexvalue) | Yes | — | Maximum SOC % (can be HA entity) (Unit: `%`) _0-100%, protects battery from overcharge_ |
116116
| `lower limit` | integer or [FlexValue](#flexvalue) | Yes | — | Minimum SOC % (can be HA entity) (Unit: `%`) _0-100%, protects battery from deep discharge_ |
117117
| `optimal lower level` | integer or [FlexValue](#flexvalue) (optional) | No | `null` | Optimal lower SOC % for cost optimization (Unit: `%`) _Optional, should be >= lower_limit_ |
118118
| `entity min soc end opt` | string (optional) | No | `null` | HA entity for minimum SOC at end of optimization period |
@@ -153,6 +153,10 @@ Home Assistant entity that reports the current State of Charge (SOC) percentage.
153153
154154
Total usable energy storage capacity of your battery. Check your battery specifications. For multiple batteries, sum their capacities.
155155
156+
**`upper limit`**
157+
158+
Maximum State of Charge in percent. Battery will never charge above this level. Supports FlexValue pattern: use integer or HA entity ID.
159+
156160
**`lower limit`**
157161
158162
Minimum State of Charge in percent. Battery will never discharge below this level. Supports FlexValue pattern: use integer or HA entity ID.

config_schema.json

Lines changed: 93 additions & 85 deletions
Large diffs are not rendered by default.

dao/prog/config/models/devices/battery.py

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class BatteryConfig(BaseModel):
5959
"x-unit": "%",
6060
"x-ui-section": "Power Configuration",
6161
"x-ui-widget": "entity-picker",
62-
"x-entity-filter": "sensor"
62+
"x-ui-widget-filter": "sensor"
6363
}
6464
)
6565
capacity: float = Field(
@@ -75,7 +75,15 @@ class BatteryConfig(BaseModel):
7575
upper_limit: int | FlexValue = Field(
7676
alias="upper limit",
7777
ge=0, le=100,
78-
description="Maximum SOC % (can be HA entity)"
78+
description="Maximum SOC % (can be HA entity)",
79+
json_schema_extra={
80+
"x-help": "Maximum State of Charge in percent. Battery will never charge above this level. Supports FlexValue pattern: use integer or HA entity ID.",
81+
"x-unit": "%",
82+
"x-ui-section": "Power Configuration",
83+
"x-validation-hint": "0-100%, protects battery from overcharge",
84+
"x-ui-widget": "entity-picker-or-literal",
85+
"x-ui-widget-filter": "sensor,input_number"
86+
}
7987
)
8088
lower_limit: int | FlexValue = Field(
8189
alias="lower limit",
@@ -86,7 +94,8 @@ class BatteryConfig(BaseModel):
8694
"x-unit": "%",
8795
"x-ui-section": "Power Configuration",
8896
"x-validation-hint": "0-100%, protects battery from deep discharge",
89-
"x-ui-widget": "entity-picker-or-number"
97+
"x-ui-widget": "entity-picker-or-literal",
98+
"x-ui-widget-filter": "sensor,input_number"
9099
}
91100
)
92101
optimal_lower_level: Optional[int | FlexValue] = Field(
@@ -99,7 +108,8 @@ class BatteryConfig(BaseModel):
99108
"x-unit": "%",
100109
"x-ui-section": "Power Configuration",
101110
"x-validation-hint": "Optional, should be >= lower_limit",
102-
"x-ui-widget": "entity-picker-or-number"
111+
"x-ui-widget": "entity-picker-or-literal",
112+
"x-ui-widget-filter": "sensor,input_number"
103113
}
104114
)
105115
entity_min_soc_end_opt: Optional[str] = Field(
@@ -110,7 +120,7 @@ class BatteryConfig(BaseModel):
110120
"x-help": "Optional: Home Assistant entity specifying minimum battery level required at end of optimization window. Useful for ensuring battery charge overnight.",
111121
"x-ui-section": "Power Configuration",
112122
"x-ui-widget": "entity-picker",
113-
"x-entity-filter": "sensor,input_number"
123+
"x-ui-widget-filter": "sensor,input_number"
114124
}
115125
)
116126
entity_max_soc_end_opt: Optional[str] = Field(
@@ -121,7 +131,7 @@ class BatteryConfig(BaseModel):
121131
"x-help": "Optional: Home Assistant entity specifying maximum battery level at end of optimization window. Rarely needed but available for advanced scenarios.",
122132
"x-ui-section": "Power Configuration",
123133
"x-ui-widget": "entity-picker",
124-
"x-entity-filter": "sensor,input_number"
134+
"x-ui-widget-filter": "sensor,input_number"
125135
}
126136
)
127137
charge_stages: list[BatteryStage] = Field(
@@ -236,7 +246,7 @@ class BatteryConfig(BaseModel):
236246
"x-help": "Optional: Home Assistant entity to control grid feed-in power. Used by scheduler to execute optimized battery operations.",
237247
"x-ui-section": "Power Configuration",
238248
"x-ui-widget": "entity-picker",
239-
"x-entity-filter": "number,input_number"
249+
"x-ui-widget-filter": "number,input_number"
240250
}
241251
)
242252
entity_set_operating_mode: Optional[str] = Field(
@@ -247,7 +257,7 @@ class BatteryConfig(BaseModel):
247257
"x-help": "Optional: Home Assistant entity to control battery operating mode (e.g., auto/manual/off). System will switch modes as needed for optimization.",
248258
"x-ui-section": "Power Configuration",
249259
"x-ui-widget": "entity-picker",
250-
"x-entity-filter": "select,input_select,switch"
260+
"x-ui-widget-filter": "select,input_select,switch"
251261
}
252262
)
253263
entity_set_operating_mode_on: Optional[str] = Field(
@@ -276,7 +286,7 @@ class BatteryConfig(BaseModel):
276286
"x-help": "Optional: Home Assistant entity to emergency stop the battery inverter. Rarely needed but available for safety scenarios.",
277287
"x-ui-section": "Power Configuration",
278288
"x-ui-widget": "entity-picker",
279-
"x-entity-filter": "switch,button"
289+
"x-ui-widget-filter": "switch,button"
280290
}
281291
)
282292
entity_balance_switch: Optional[str] = Field(
@@ -287,7 +297,7 @@ class BatteryConfig(BaseModel):
287297
"x-help": "Optional: Home Assistant entity to enable/disable grid balancing mode. Used for frequency regulation participation or grid services.",
288298
"x-ui-section": "Power Configuration",
289299
"x-ui-widget": "entity-picker",
290-
"x-entity-filter": "switch"
300+
"x-ui-widget-filter": "switch"
291301
}
292302
)
293303

@@ -301,7 +311,7 @@ class BatteryConfig(BaseModel):
301311
"x-unit": "W",
302312
"x-ui-section": "Power Configuration",
303313
"x-ui-widget": "entity-picker",
304-
"x-entity-filter": "sensor"
314+
"x-ui-widget-filter": "sensor"
305315
}
306316
)
307317
entity_from_pv: Optional[str] = Field(
@@ -313,7 +323,7 @@ class BatteryConfig(BaseModel):
313323
"x-unit": "W",
314324
"x-ui-section": "Power Configuration",
315325
"x-ui-widget": "entity-picker",
316-
"x-entity-filter": "sensor"
326+
"x-ui-widget-filter": "sensor"
317327
}
318328
)
319329
entity_from_ac: Optional[str] = Field(
@@ -325,7 +335,7 @@ class BatteryConfig(BaseModel):
325335
"x-unit": "W",
326336
"x-ui-section": "Power Configuration",
327337
"x-ui-widget": "entity-picker",
328-
"x-entity-filter": "sensor"
338+
"x-ui-widget-filter": "sensor"
329339
}
330340
)
331341
entity_calculated_soc: Optional[str] = Field(
@@ -337,7 +347,7 @@ class BatteryConfig(BaseModel):
337347
"x-unit": "%",
338348
"x-ui-section": "Power Configuration",
339349
"x-ui-widget": "entity-picker",
340-
"x-entity-filter": "sensor"
350+
"x-ui-widget-filter": "sensor"
341351
}
342352
)
343353

dao/prog/config/models/devices/boiler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class BoilerConfig(BaseModel):
2727
"x-unit": "°C",
2828
"x-ui-section": "General",
2929
"x-ui-widget": "entity-picker",
30-
"x-entity-filter": "sensor"
30+
"x-ui-widget-filter": "sensor"
3131
}
3232
)
3333
entity_setpoint: str = Field(
@@ -38,7 +38,7 @@ class BoilerConfig(BaseModel):
3838
"x-unit": "°C",
3939
"x-ui-section": "General",
4040
"x-ui-widget": "entity-picker",
41-
"x-entity-filter": "input_number,number,sensor"
41+
"x-ui-widget-filter": "input_number,number,sensor"
4242
}
4343
)
4444
entity_hysterese: str = Field(
@@ -49,7 +49,7 @@ class BoilerConfig(BaseModel):
4949
"x-unit": "°C",
5050
"x-ui-section": "General",
5151
"x-ui-widget": "entity-picker",
52-
"x-entity-filter": "input_number,number,sensor"
52+
"x-ui-widget-filter": "input_number,number,sensor"
5353
}
5454
)
5555
entity_enabled: Optional[str] = Field(
@@ -60,7 +60,7 @@ class BoilerConfig(BaseModel):
6060
"x-help": "Optional: Home Assistant binary sensor indicating if boiler is enabled. System will only optimize when boiler is enabled.",
6161
"x-ui-section": "General",
6262
"x-ui-widget": "entity-picker",
63-
"x-entity-filter": "binary_sensor"
63+
"x-ui-widget-filter": "binary_sensor"
6464
}
6565
)
6666
entity_instant_start: Optional[str] = Field(
@@ -71,7 +71,7 @@ class BoilerConfig(BaseModel):
7171
"x-help": "Optional: Home Assistant entity to trigger immediate boiler heating. Overrides optimized schedule for on-demand hot water.",
7272
"x-ui-section": "General",
7373
"x-ui-widget": "entity-picker",
74-
"x-entity-filter": "switch,input_boolean,button"
74+
"x-ui-widget-filter": "switch,input_boolean,button"
7575
}
7676
)
7777
cop: float = Field(
@@ -144,7 +144,7 @@ class BoilerConfig(BaseModel):
144144
"x-help": "Home Assistant entity used to activate boiler heating. System will trigger this entity using activate_service when heating is needed.",
145145
"x-ui-section": "General",
146146
"x-ui-widget": "entity-picker",
147-
"x-entity-filter": "button,switch"
147+
"x-ui-widget-filter": "button,switch"
148148
}
149149
)
150150

dao/prog/config/models/devices/ev.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class EVChargeScheduler(BaseModel):
5050
"x-unit": "%",
5151
"x-ui-section": "General",
5252
"x-ui-widget": "entity-picker",
53-
"x-entity-filter": "input_number,number"
53+
"x-ui-widget-filter": "input_number,number"
5454
}
5555
)
5656
level_margin: int = Field(
@@ -71,7 +71,7 @@ class EVChargeScheduler(BaseModel):
7171
"x-help": "Home Assistant datetime entity specifying when vehicle must be charged. System will optimize charging schedule to minimize cost while meeting deadline.",
7272
"x-ui-section": "General",
7373
"x-ui-widget": "entity-picker",
74-
"x-entity-filter": "input_datetime,datetime"
74+
"x-ui-widget-filter": "input_datetime,datetime"
7575
}
7676
)
7777

@@ -112,7 +112,7 @@ class EVConfig(BaseModel):
112112
"x-help": "Home Assistant device tracker entity to detect if vehicle is home. Charging is only scheduled when vehicle is at home location.",
113113
"x-ui-section": "General",
114114
"x-ui-widget": "entity-picker",
115-
"x-entity-filter": "device_tracker"
115+
"x-ui-widget-filter": "device_tracker"
116116
}
117117
)
118118
charge_three_phase: bool | str = Field(
@@ -143,7 +143,7 @@ class EVConfig(BaseModel):
143143
"x-unit": "%",
144144
"x-ui-section": "General",
145145
"x-ui-widget": "entity-picker",
146-
"x-entity-filter": "sensor"
146+
"x-ui-widget-filter": "sensor"
147147
}
148148
)
149149
entity_plugged_in: str = Field(
@@ -153,7 +153,7 @@ class EVConfig(BaseModel):
153153
"x-help": "Home Assistant binary sensor indicating if vehicle is plugged into charger. Charging is only possible when plugged in.",
154154
"x-ui-section": "General",
155155
"x-ui-widget": "entity-picker",
156-
"x-entity-filter": "binary_sensor"
156+
"x-ui-widget-filter": "binary_sensor"
157157
}
158158
)
159159
entity_instant_start: Optional[str] = Field(
@@ -164,7 +164,7 @@ class EVConfig(BaseModel):
164164
"x-help": "Optional: Home Assistant entity to trigger immediate charging. Use with entity_instant_level for instant charging mode. Alternative to charge_scheduler.",
165165
"x-ui-section": "General",
166166
"x-ui-widget": "entity-picker",
167-
"x-entity-filter": "switch,input_boolean"
167+
"x-ui-widget-filter": "switch,input_boolean"
168168
}
169169
)
170170
entity_instant_level: Optional[str] = Field(
@@ -176,7 +176,7 @@ class EVConfig(BaseModel):
176176
"x-unit": "%",
177177
"x-ui-section": "General",
178178
"x-ui-widget": "entity-picker",
179-
"x-entity-filter": "input_number,number,sensor"
179+
"x-ui-widget-filter": "input_number,number,sensor"
180180
}
181181
)
182182
charge_scheduler: Optional[EVChargeScheduler] = Field(
@@ -195,7 +195,7 @@ class EVConfig(BaseModel):
195195
"x-help": "Home Assistant switch entity to start/stop charging. System will control this to execute optimized charging schedule.",
196196
"x-ui-section": "General",
197197
"x-ui-widget": "entity-picker",
198-
"x-entity-filter": "switch"
198+
"x-ui-widget-filter": "switch"
199199
}
200200
)
201201
entity_set_charging_ampere: str = Field(
@@ -206,7 +206,7 @@ class EVConfig(BaseModel):
206206
"x-unit": "A",
207207
"x-ui-section": "General",
208208
"x-ui-widget": "entity-picker",
209-
"x-entity-filter": "number,input_number"
209+
"x-ui-widget-filter": "number,input_number"
210210
}
211211
)
212212
entity_stop_charging: str = Field(
@@ -216,7 +216,7 @@ class EVConfig(BaseModel):
216216
"x-help": "Home Assistant datetime entity specifying when to stop charging. Provides manual override of optimized schedule.",
217217
"x-ui-section": "General",
218218
"x-ui-widget": "entity-picker",
219-
"x-entity-filter": "input_datetime,datetime"
219+
"x-ui-widget-filter": "input_datetime,datetime"
220220
}
221221
)
222222

dao/prog/config/models/devices/heating.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class HeatingConfig(BaseModel):
6262
"x-help": "Optional: Home Assistant binary sensor indicating if heat pump is enabled and operational. System will only optimize when enabled.",
6363
"x-ui-section": "General",
6464
"x-ui-widget": "entity-picker",
65-
"x-entity-filter": "binary_sensor"
65+
"x-ui-widget-filter": "binary_sensor"
6666
}
6767
)
6868
degree_days_factor: float = Field(
@@ -102,7 +102,7 @@ class HeatingConfig(BaseModel):
102102
"x-help": "Optional: Home Assistant entity to adjust heating curve. Used when adjustment mode is 'heating curve'. Controls water temperature based on outdoor temperature.",
103103
"x-ui-section": "General",
104104
"x-ui-widget": "entity-picker",
105-
"x-entity-filter": "number,input_number"
105+
"x-ui-widget-filter": "number,input_number"
106106
}
107107
)
108108
adjustment_factor: Optional[float] = Field(
@@ -137,7 +137,7 @@ class HeatingConfig(BaseModel):
137137
"x-unit": "kWh",
138138
"x-ui-section": "General",
139139
"x-ui-widget": "entity-picker",
140-
"x-entity-filter": "sensor"
140+
"x-ui-widget-filter": "sensor"
141141
}
142142
)
143143
entity_hp_heat_demand: Optional[str] = Field(
@@ -149,7 +149,7 @@ class HeatingConfig(BaseModel):
149149
"x-unit": "W",
150150
"x-ui-section": "General",
151151
"x-ui-widget": "entity-picker",
152-
"x-entity-filter": "sensor"
152+
"x-ui-widget-filter": "sensor"
153153
}
154154
)
155155
entity_avg_temp: Optional[str] = Field(
@@ -161,7 +161,7 @@ class HeatingConfig(BaseModel):
161161
"x-unit": "°C",
162162
"x-ui-section": "General",
163163
"x-ui-widget": "entity-picker",
164-
"x-entity-filter": "sensor"
164+
"x-ui-widget-filter": "sensor"
165165
}
166166
)
167167
entity_hp_cop: Optional[str] = Field(
@@ -173,7 +173,7 @@ class HeatingConfig(BaseModel):
173173
"x-unit": "ratio",
174174
"x-ui-section": "General",
175175
"x-ui-widget": "entity-picker",
176-
"x-entity-filter": "sensor"
176+
"x-ui-widget-filter": "sensor"
177177
}
178178
)
179179
entity_hp_power: Optional[str] = Field(
@@ -185,7 +185,7 @@ class HeatingConfig(BaseModel):
185185
"x-unit": "W",
186186
"x-ui-section": "General",
187187
"x-ui-widget": "entity-picker",
188-
"x-entity-filter": "sensor"
188+
"x-ui-widget-filter": "sensor"
189189
}
190190
)
191191
entity_hp_switch: Optional[str] = Field(
@@ -196,7 +196,7 @@ class HeatingConfig(BaseModel):
196196
"x-help": "Optional: Home Assistant switch to control heat pump on/off. Used by scheduler to execute optimized heating schedule.",
197197
"x-ui-section": "General",
198198
"x-ui-widget": "entity-picker",
199-
"x-entity-filter": "switch"
199+
"x-ui-widget-filter": "switch"
200200
}
201201
)
202202

0 commit comments

Comments
 (0)