peetereczek / ztm Goto Github PK
View Code? Open in Web Editor NEWHome Assistant (hass.io) custom component for Warsaw public transport
License: MIT License
Home Assistant (hass.io) custom component for Warsaw public transport
License: MIT License
Every couple of minutes i get error like this for each of my sensors:
2020-11-13 12:28:28 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_126_from_1097_01 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 278, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 474, in async_device_update
raise exc
File "/config/custom_components/ztm/sensor.py", line 139, in async_update
self._timetable = self.map_results(res.get('response', []))
File "/config/custom_components/ztm/sensor.py", line 212, in map_results
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 212, in <listcomp>
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 218, in parse_raw_timetable
for val in raw_result['values']:
TypeError: string indices must be integers
Is it possible to turn on/off title? If not can you implement it?
Hello
Getting recently below error. Can you advice please ?
Logger: homeassistant.helpers.entity
Source: custom_components/ztm/sensor.py:218
Integration: ztm (documentation, issues)
First occurred: 21:25:48 (12 occurrences)
Last logged: 21:26:48
Update for sensor.ztm_11_from_5061_04 fails
Update for sensor.ztm_171_from_5061_01 fails
Update for sensor.ztm_26_from_5061_04 fails
Update for sensor.ztm_10_from_5061_04 fails
Update for sensor.ztm_523_from_5061_01 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 350, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 558, in async_device_update
raise exc
File "/config/custom_components/ztm/sensor.py", line 139, in async_update
self._timetable = self.map_results(res.get('response', []))
File "/config/custom_components/ztm/sensor.py", line 212, in map_results
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 212, in
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 218, in parse_raw_timetable
for val in raw_result['values']:
TypeError: string indices must be integers
Cześć
Od wczoraj mam powtarzający się błąd - 2020-11-16 07:55:18 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.xxxxxx fails i leci mi tak po wszystkich utworzonych. Co może być przyczyną?
Rafał
Cześć,
Przełaczyłem HA na bazę MySQL, zamiast wbudowanej. Po starcie jest taki probłem:
2020-07-24 10:24:18 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_105_from_5045_01 fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 272, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 463, in async_device_update
await self.async_update() # type: ignore
File "/config/custom_components/ztm/sensor.py", line 139, in async_update
self._timetable = self.map_results(res.get('response', []))
File "/config/custom_components/ztm/sensor.py", line 212, in map_results
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 212, in
return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 218, in parse_raw_timetable
for val in raw_result['values']:
TypeError: string indices must be integers
Pozostałe integracje działają
No 'version' key in the manifest file for custom integration 'ztm'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'ztm'
Napisałem w php prosty extractor przystanków, może jakoś da sie to zintegrować
<form method="post" action="/">
Link: <input type="text" name="link"><br>
<input type="submit" value="Parsuj">
</form>
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
$parts = parse_url($_POST['link']);
parse_str($parts['query'], $query);
echo "number: " . $query['wtp_ln']. "<br>";
echo "stop_id: " . $query['wtp_st']. "<br>";
echo "stop_number: \"" .$query['wtp_pt'] . "\"";
}
Po ostatnim updacie (0.2.0) zaczęło sypać mi błędami:
Cannot connect to ZTM API endpoint.
Sprawdziłem klucz i po stronie API wszystko wygląda OK.
Zapewne w wyniku czego, pojawia się błąd odczytu:
Update for sensor.ztm_xxx_from_xxxx_xx 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 136, in async_update
if res.get('error', ''):
AttributeError: 'NoneType' object has no attribute 'get'
Powrót do 0.1.3 usuwa problem.
Entity sensor.ztm_33_from_6027_04 (<class 'custom_components.ztm.sensor.ZTMSensor'>) implements device_state_attributes. Please report it to the custom component author.
Taki przypadek: Linia 715 odjeżdża z tego samego przystanku w 2 różne strony:
https://www.wtp.waw.pl/rozklady-jazdy/?wtp_dt=2020-02-02&wtp_md=5&wtp_ln=715&wtp_st=4174&wtp_pt=02&wtp_dr=B&wtp_vr=0&wtp_dy=7&wtp_lm=1
przydałoby się aby można opcjonalnie pominąć niektóre odjazdy z pewnymi adnotacjami - np. w postaci takiej konfuguracji:
lines:
- number: 715
stop_id: 4173
stop_number: "02"
skip_annotation: w
Poza tym - super!
Za dokumentacją:
number:
description: Bus/tram line number
required: true
type: int
Nie da się teraz podać np. linii nocnej. Np. N64
Detected integration that called async_timeout.timeout with loop keyword argument. The loop keyword argument is deprecated and calls will fail after Home Assistant 2022.2. Please report issue to the custom component author for ztm using this method at custom_components/ztm/sensor.py, line 233: with async_timeout.timeout(REQUEST_TIMEOUT, loop=loop):
konfiguracja:
- 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"
błędy:
2020-02-05 22:55:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_126_departures_from_1097_01 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
2020-02-05 22:55:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_176_departures_from_1097_01 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
2020-02-05 22:55:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_126_departures_from_1097_03 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
2020-02-05 22:56:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_126_departures_from_1097_01 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
2020-02-05 22:56:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_126_departures_from_1097_03 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
2020-02-05 22:56:31 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.ztm_176_departures_from_1097_01 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 155, in async_update
if nocny != '':
UnboundLocalError: local variable 'nocny' referenced before assignment
Wyniki odpowiedzi na zapytanie nie są parsowane do sensora
Update for sensor.ztm_217_from_3309_02 failsTraceback (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 139, in async_update self._timetable = self.map_results(res.get('response', []))
File "/config/custom_components/ztm/sensor.py", line 212, in map_results return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 212, in <listcomp> return [parse_raw_timetable(row) for row in response['result']]
File "/config/custom_components/ztm/sensor.py", line 218, in parse_raw_timetable for val in raw_result['values']:
TypeError: string indices must be integers
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.