Fix Islamic prayer times naming (#34784)
parent
24fd395d09
commit
6e0d61e5e8
|
@ -1,12 +1,19 @@
|
|||
"""Constants for the Islamic Prayer component."""
|
||||
DOMAIN = "islamic_prayer_times"
|
||||
NAME = "Islamic Prayer Times"
|
||||
SENSOR_SUFFIX = "Prayer"
|
||||
PRAYER_TIMES_ICON = "mdi:calendar-clock"
|
||||
|
||||
SENSOR_TYPES = ["Fajr", "Sunrise", "Dhuhr", "Asr", "Maghrib", "Isha", "Midnight"]
|
||||
SENSOR_TYPES = {
|
||||
"Fajr": "prayer",
|
||||
"Sunrise": "time",
|
||||
"Dhuhr": "prayer",
|
||||
"Asr": "prayer",
|
||||
"Maghrib": "prayer",
|
||||
"Isha": "prayer",
|
||||
"Midnight": "time",
|
||||
}
|
||||
|
||||
CONF_CALC_METHOD = "calc_method"
|
||||
CONF_CALC_METHOD = "calculation_method"
|
||||
|
||||
CALC_METHODS = ["isna", "karachi", "mwl", "makkah"]
|
||||
DEFAULT_CALC_METHOD = "isna"
|
||||
|
|
|
@ -5,7 +5,7 @@ from homeassistant.const import DEVICE_CLASS_TIMESTAMP
|
|||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_SUFFIX, SENSOR_TYPES
|
||||
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -33,7 +33,7 @@ class IslamicPrayerTimeSensor(Entity):
|
|||
@property
|
||||
def name(self):
|
||||
"""Return the name of the sensor."""
|
||||
return f"{self.sensor_type} {SENSOR_SUFFIX}"
|
||||
return f"{self.sensor_type} {SENSOR_TYPES[self.sensor_type]}"
|
||||
|
||||
@property
|
||||
def unique_id(self):
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"calc_method": "Prayer calculation method"
|
||||
"calculation_method": "Prayer calculation method"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
{
|
||||
"config": {
|
||||
"abort": {
|
||||
"one_instance_allowed": "Only a single instance is necessary."
|
||||
},
|
||||
"step": {
|
||||
"user": {
|
||||
"description": "Do you want to set up Islamic Prayer Times?",
|
||||
"title": "Set up Islamic Prayer Times"
|
||||
}
|
||||
}
|
||||
"config": {
|
||||
"abort": {
|
||||
"one_instance_allowed": "Only a single instance is necessary."
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"calc_method": "Prayer calculation method"
|
||||
}
|
||||
}
|
||||
"step": {
|
||||
"user": {
|
||||
"description": "Do you want to set up Islamic Prayer Times?",
|
||||
"title": "Set up Islamic Prayer Times"
|
||||
}
|
||||
}
|
||||
},
|
||||
"options": {
|
||||
"step": {
|
||||
"init": {
|
||||
"data": {
|
||||
"calculation_method": "Prayer calculation method"
|
||||
}
|
||||
},
|
||||
"title": "Islamic Prayer Times"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"title": "Islamic Prayer Times"
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ async def test_islamic_prayer_times_sensors(hass):
|
|||
|
||||
for prayer in PRAYER_TIMES:
|
||||
assert (
|
||||
hass.states.get(f"sensor.{prayer}_prayer").state
|
||||
hass.states.get(
|
||||
f"sensor.{prayer}_{islamic_prayer_times.const.SENSOR_TYPES[prayer]}"
|
||||
).state
|
||||
== PRAYER_TIMES_TIMESTAMPS[prayer].isoformat()
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue