File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
homeassistant/components/brother Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 1313from homeassistant .core import HomeAssistant
1414from homeassistant .data_entry_flow import section
1515from homeassistant .exceptions import HomeAssistantError
16+ from homeassistant .helpers .selector import SelectSelector , SelectSelectorConfig
1617from homeassistant .helpers .service_info .zeroconf import ZeroconfServiceInfo
1718from homeassistant .util .network import is_host_valid
1819
2122 DEFAULT_COMMUNITY ,
2223 DEFAULT_PORT ,
2324 DOMAIN ,
25+ PRINTER_TYPE_LASER ,
2426 PRINTER_TYPES ,
2527 SECTION_ADVANCED_SETTINGS ,
2628)
2729
2830DATA_SCHEMA = vol .Schema (
2931 {
3032 vol .Required (CONF_HOST ): str ,
31- vol .Optional (CONF_TYPE , default = "laser" ): vol .In (PRINTER_TYPES ),
33+ vol .Required (CONF_TYPE , default = PRINTER_TYPE_LASER ): SelectSelector (
34+ SelectSelectorConfig (
35+ options = PRINTER_TYPES ,
36+ translation_key = "printer_type" ,
37+ )
38+ ),
3239 vol .Required (SECTION_ADVANCED_SETTINGS ): section (
3340 vol .Schema (
3441 {
4249)
4350ZEROCONF_SCHEMA = vol .Schema (
4451 {
45- vol .Optional (CONF_TYPE , default = "laser" ): vol .In (PRINTER_TYPES ),
52+ vol .Required (CONF_TYPE , default = PRINTER_TYPE_LASER ): SelectSelector (
53+ SelectSelectorConfig (
54+ options = PRINTER_TYPES ,
55+ translation_key = "printer_type" ,
56+ )
57+ ),
4658 vol .Required (SECTION_ADVANCED_SETTINGS ): section (
4759 vol .Schema (
4860 {
Original file line number Diff line number Diff line change 77
88DOMAIN : Final = "brother"
99
10- PRINTER_TYPES : Final = ["laser" , "ink" ]
10+ PRINTER_TYPE_LASER = "laser"
11+ PRINTER_TYPE_INK = "ink"
12+
13+ PRINTER_TYPES : Final = [PRINTER_TYPE_LASER , PRINTER_TYPE_INK ]
1114
1215UPDATE_INTERVAL = timedelta (seconds = 30 )
1316
Original file line number Diff line number Diff line change 3838 "user" : {
3939 "data" : {
4040 "host" : " [%key:common::config_flow::data::host%]" ,
41- "type" : " Type of the printer "
41+ "type" : " Printer type "
4242 },
4343 "data_description" : {
4444 "host" : " The hostname or IP address of the Brother printer to control." ,
45- "type" : " Brother printer type: ink or laser ."
45+ "type" : " The type of the Brother printer ."
4646 },
4747 "sections" : {
4848 "advanced_settings" : {
210210 "update_error" : {
211211 "message" : " An error occurred while retrieving data from the {device} printer: {error}"
212212 }
213+ },
214+ "selector" : {
215+ "printer_type" : {
216+ "options" : {
217+ "ink" : " ink" ,
218+ "laser" : " laser"
219+ }
220+ }
213221 }
214222}
You can’t perform that action at this time.
0 commit comments