File tree Expand file tree Collapse file tree
custom_components/label_state Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from homeassistant .helpers .schema_config_entry_flow import (
1212 SchemaCommonFlowHandler ,
1313 SchemaConfigFlowHandler ,
14+ SchemaFlowError ,
1415 SchemaFlowFormStep ,
1516 SchemaFlowMenuStep ,
1617)
@@ -85,7 +86,7 @@ def _validate_upper_or_lower(options: dict[str, Any]) -> None:
8586 lower_limit = options .get (CONF_LOWER_LIMIT )
8687
8788 if upper_limit is None and lower_limit is None :
88- raise vol . Invalid ( "An upper or lower limit must be set " )
89+ raise SchemaFlowError ( "upper_or_lower_not_specified " )
8990
9091
9192def _validate_from_or_to (options : dict [str , Any ]) -> None :
@@ -94,7 +95,7 @@ def _validate_from_or_to(options: dict[str, Any]) -> None:
9495 state_to = options .get (CONF_STATE_TO )
9596
9697 if state_from is None and state_to is None :
97- raise vol . Invalid ( "A from or to must be specified " )
98+ raise SchemaFlowError ( "from_or_to_not_specified " )
9899
99100
100101def validate_user_input (
Original file line number Diff line number Diff line change 11{
22 "config" : {
3+ "error" : {
4+ "from_or_to_not_specified" : " A from or to must be specified." ,
5+ "upper_or_lower_not_specified" : " An upper or lower limit must be set."
6+ },
37 "step" : {
48 "user" : {
59 "title" : " Label State" ,
3640 }
3741 },
3842 "options" : {
43+ "error" : {
44+ "from_or_to_not_specified" : " A from or to must be specified." ,
45+ "upper_or_lower_not_specified" : " An upper or lower limit must be set."
46+ },
3947 "step" : {
4048 "numeric_state" : {
4149 "title" : " Label State" ,
6068 }
6169 }
6270 }
63- },
64- "selector" : {
65- "type" : {
66- "options" : {
67- "min" : " Minimum" ,
68- "max" : " Maximum"
69- }
70- }
71- },
72- "services" : {
73- "reset" : {
74- "name" : " Reset" ,
75- "description" : " Reset a Label State sensor to the current input entity value." ,
76- "fields" : {
77- "entity_id" : {
78- "name" : " Entity" ,
79- "description" : " Select the Label State sensor."
80- }
81- }
82- }
8371 }
8472}
You can’t perform that action at this time.
0 commit comments