Skip to content

Commit 6e0d61e

Browse files
authored
Fix Islamic prayer times naming (#34784)
1 parent 24fd395 commit 6e0d61e

File tree

5 files changed

+36
-27
lines changed

5 files changed

+36
-27
lines changed

homeassistant/components/islamic_prayer_times/const.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
"""Constants for the Islamic Prayer component."""
22
DOMAIN = "islamic_prayer_times"
33
NAME = "Islamic Prayer Times"
4-
SENSOR_SUFFIX = "Prayer"
54
PRAYER_TIMES_ICON = "mdi:calendar-clock"
65

7-
SENSOR_TYPES = ["Fajr", "Sunrise", "Dhuhr", "Asr", "Maghrib", "Isha", "Midnight"]
6+
SENSOR_TYPES = {
7+
"Fajr": "prayer",
8+
"Sunrise": "time",
9+
"Dhuhr": "prayer",
10+
"Asr": "prayer",
11+
"Maghrib": "prayer",
12+
"Isha": "prayer",
13+
"Midnight": "time",
14+
}
815

9-
CONF_CALC_METHOD = "calc_method"
16+
CONF_CALC_METHOD = "calculation_method"
1017

1118
CALC_METHODS = ["isna", "karachi", "mwl", "makkah"]
1219
DEFAULT_CALC_METHOD = "isna"

homeassistant/components/islamic_prayer_times/sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from homeassistant.helpers.dispatcher import async_dispatcher_connect
66
from homeassistant.helpers.entity import Entity
77

8-
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_SUFFIX, SENSOR_TYPES
8+
from .const import DATA_UPDATED, DOMAIN, PRAYER_TIMES_ICON, SENSOR_TYPES
99

1010
_LOGGER = logging.getLogger(__name__)
1111

@@ -33,7 +33,7 @@ def __init__(self, sensor_type, client):
3333
@property
3434
def name(self):
3535
"""Return the name of the sensor."""
36-
return f"{self.sensor_type} {SENSOR_SUFFIX}"
36+
return f"{self.sensor_type} {SENSOR_TYPES[self.sensor_type]}"
3737

3838
@property
3939
def unique_id(self):

homeassistant/components/islamic_prayer_times/strings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"step": {
1616
"init": {
1717
"data": {
18-
"calc_method": "Prayer calculation method"
18+
"calculation_method": "Prayer calculation method"
1919
}
2020
}
2121
}
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
2-
"config": {
3-
"abort": {
4-
"one_instance_allowed": "Only a single instance is necessary."
5-
},
6-
"step": {
7-
"user": {
8-
"description": "Do you want to set up Islamic Prayer Times?",
9-
"title": "Set up Islamic Prayer Times"
10-
}
11-
}
2+
"config": {
3+
"abort": {
4+
"one_instance_allowed": "Only a single instance is necessary."
125
},
13-
"options": {
14-
"step": {
15-
"init": {
16-
"data": {
17-
"calc_method": "Prayer calculation method"
18-
}
19-
}
6+
"step": {
7+
"user": {
8+
"description": "Do you want to set up Islamic Prayer Times?",
9+
"title": "Set up Islamic Prayer Times"
10+
}
11+
}
12+
},
13+
"options": {
14+
"step": {
15+
"init": {
16+
"data": {
17+
"calculation_method": "Prayer calculation method"
2018
}
21-
},
22-
"title": "Islamic Prayer Times"
23-
}
19+
}
20+
}
21+
},
22+
"title": "Islamic Prayer Times"
23+
}

tests/components/islamic_prayer_times/test_sensor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ async def test_islamic_prayer_times_sensors(hass):
2323

2424
for prayer in PRAYER_TIMES:
2525
assert (
26-
hass.states.get(f"sensor.{prayer}_prayer").state
26+
hass.states.get(
27+
f"sensor.{prayer}_{islamic_prayer_times.const.SENSOR_TYPES[prayer]}"
28+
).state
2729
== PRAYER_TIMES_TIMESTAMPS[prayer].isoformat()
2830
)

0 commit comments

Comments
 (0)