Closed jacekpaszkowski closed 4 years ago
Zgoda, błąd w dokumentacji, już poprawiam.
Przy okazji sprawdziłem jak API zwraca godziny nocne:
{
"values": [
{
"value": "null",
"key": "symbol_2"
},
{
"value": "null",
"key": "symbol_1"
},
{
"value": "251",
"key": "brygada"
},
{
"value": "os.Kabaty",
"key": "kierunek"
},
{
"value": "TP-MKA",
"key": "trasa"
},
{
"value": "28:47:00",
"key": "czas"
}
]
}
Za chwilę zrobię release z poprawką wspierającą rozkład autobusów nocnych
Dodałem konfigurację:
- platform: ztm
api_key: !secret ztm_api_key
lines:
- number: "126"
stop_id: 1097
stop_number: "01"
- number: "176"
stop_id: 1097
stop_number: "01"
- number: "126"
stop_id: 1097
stop_number: "03"
- number: "N64"
stop_id: 1097
stop_number: "02"
- number: "N64"
stop_id: 1096
stop_number: "02"
w logu mam błędy:
2020-02-03 23:46:36 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1097_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
2020-02-03 23:46:36 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1096_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
dodaj bez cudzysłowia
lines:
- number: N37
stop_id: 7013
stop_number: "01"
jakoś nie chce mi zadziałać... dalej mam wyjątki
2020-02-04 10:06:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1096_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
2020-02-04 10:06:09 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1097_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
2020-02-04 10:07:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1097_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
2020-02-04 10:07:10 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_n64_departures_from_1096_02 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 459, in async_device_update
await self.async_update()
File "/config/custom_components/ztm/sensor.py", line 147, in async_update
entry_dt = datetime.combine(now.date(), entry_time)
TypeError: combine() argument 2 must be datetime.time, not None
Zgadza się, to wynika z godzin odjazdu typu 25:30:00. Jeszcze testuję rozwiązanie i może dziś w nocy opublikuję
Za dokumentacją:
Nie da się teraz podać np. linii nocnej. Np. N64