Add translation support for utility_meter type in config flow (#86220)

* Add translation support for utility_meter type

* Remove redundant labels
This commit is contained in:
Jan Bouwhuis 2023-01-24 12:52:26 +01:00 committed by GitHub
parent 63bddae01d
commit c97cf62b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 11 deletions

View File

@ -35,15 +35,15 @@ from .const import (
) )
METER_TYPES = [ METER_TYPES = [
selector.SelectOptionDict(value="none", label="No cycle"), "none",
selector.SelectOptionDict(value=QUARTER_HOURLY, label="Every 15 minutes"), QUARTER_HOURLY,
selector.SelectOptionDict(value=HOURLY, label="Hourly"), HOURLY,
selector.SelectOptionDict(value=DAILY, label="Daily"), DAILY,
selector.SelectOptionDict(value=WEEKLY, label="Weekly"), WEEKLY,
selector.SelectOptionDict(value=MONTHLY, label="Monthly"), MONTHLY,
selector.SelectOptionDict(value=BIMONTHLY, label="Every two months"), BIMONTHLY,
selector.SelectOptionDict(value=QUARTERLY, label="Quarterly"), QUARTERLY,
selector.SelectOptionDict(value=YEARLY, label="Yearly"), YEARLY,
] ]
@ -74,7 +74,9 @@ CONFIG_SCHEMA = vol.Schema(
selector.EntitySelectorConfig(domain=SENSOR_DOMAIN), selector.EntitySelectorConfig(domain=SENSOR_DOMAIN),
), ),
vol.Required(CONF_METER_TYPE): selector.SelectSelector( vol.Required(CONF_METER_TYPE): selector.SelectSelector(
selector.SelectSelectorConfig(options=METER_TYPES), selector.SelectSelectorConfig(
options=METER_TYPES, translation_key=CONF_METER_TYPE
),
), ),
vol.Required(CONF_METER_OFFSET, default=0): selector.NumberSelector( vol.Required(CONF_METER_OFFSET, default=0): selector.NumberSelector(
selector.NumberSelectorConfig( selector.NumberSelectorConfig(

View File

@ -31,5 +31,20 @@
} }
} }
} }
},
"selector": {
"cycle": {
"options": {
"none": "No cycle",
"quarter-hourly": "Every 15 minutes",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"bimonthly": "Every two months",
"quarterly": "Quarterly",
"yearly": "Yearly"
}
}
} }
} }

View File

@ -31,5 +31,20 @@
} }
} }
}, },
"title": "Utility Meter" "title": "Utility Meter",
"selector": {
"cycle": {
"options": {
"none": "No cycle",
"quarter-hourly": "Every 15 minutes",
"hourly": "Hourly",
"daily": "Daily",
"weekly": "Weekly",
"monthly": "Monthly",
"bimonthly": "Every two months",
"quarterly": "Quarterly",
"yearly": "Yearly"
}
}
}
} }