Działa bez problemów.
Może przekroczyłeś limit zapytań.
Nie, nie przekroczyłem. Możesz podrzucić flow?
Ewentualnie zerknij na nody, przy ktorych mam ECONNREFUSED.
flows(2).json (767 bajtów)
Airly.json (19,0 KB)
ECONNREFUSED → połączenie zostało odrzucone przez serwer.
Komunikat jest dla mnie jasny, pytanie dlaczego? Sama integracja działa:
@artpc W Twoim flow też mam ECONNREFUSED Zgodnie z regulaminem mogę zapytać serwer:
Użytkownik zobowiązuje się do nieprzekraczania maksymalnej liczby zapytań serwera Airly API
wynoszącej 100 zapytań/dzień i. Pozostała do wykorzystania liczba zapytań widoczna jest dla
Użytkownika w nagłówku (x-ratelimit-remaining-minute lub x-ratelimit-remaining-day) odpowiedzi
serwera.
EDIT:
Założyłem nowe konto - nowe API Key - dalej to samo.
EDIT2:
Dziwna sytuacja, jak łącze się z airapi.airly.eu po http wszystko zaczęło działać. Po https mam ECONNREFUSED.
Przy https podejrzanie wygląda próba połączenia do localhost:
Kod zmieniony żeby działał dla domyślnej wersji
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.airly_wspolny_indeks_jakosci_powietrza
aspect_ratio: 3/1
color_type: card
show_state: true
show_label: true
show_icon: false
label: >
[[[ return "<b>CZYSTOŚĆ POWIETRZA</b></BR>Poziom:
"+entity.attributes.level + "<br>" + entity.attributes.description+
"<br>" +
entity.attributes.advice ]]]
styles:
grid:
- grid-template-areas: " \"s l\" \"s l\" "
- grid-template-columns: 30% 75%
label:
- white-space: normal
- font-size: 14px
- justify-self: center
- margin-left: "-30%"
- margin-top: 2%
state:
- font-size: 18px
- font-weight: bold
- justify-self: center
- align-self: start
- margin-left: "-35%"
- margin-top: 35%
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
}
- type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- entity: sensor.airly_pm2_5
type: attribute
attribute: percent
unit: "%"
- entity: sensor.airly_pm2_5
show_graph: false
show_state: true
show:
icon: false
color_thresholds:
- value: 20
color: "#68c920"
- value: 50
color: "#d35400"
- value: 70
color: "#ff1200"
line_width: 4
font_size: 50
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- entity: sensor.airly_pm10
type: attribute
attribute: percent
unit: "%"
- entity: sensor.airly_pm10
show_graph: false
show_state: true
show:
icon: false
color_thresholds:
- value: 20
color: "#68c920"
- value: 50
color: "#d35400"
- value: 70
color: "#ff1200"
line_width: 4
font_size: 50
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- sensor.airly_pm1
show:
icon: false
color_thresholds:
- value: 10
color: "#68c920"
- value: 30
color: "#d35400"
- value: 60
color: "#ff1200"
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- sensor.airly_temperatura
name: Temperatura
color_thresholds:
- value: -7
color: "#157feb"
- value: 0
color: "#4dd2fd"
- value: 5
color: "#2ae96d"
- value: 10
color: "#2ae96d"
- value: 15
color: "#e2e92a"
- value: 20
color: "#e9d02a"
- value: 25
color: "#f7b923"
- value: 30
color: "#f79623"
- value: 35
color: "#f75a23"
- value: 40
color: "#f75a23"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- sensor.airly_wilgotnosc
name: Wilgotność
color_thresholds:
- value: 5
color: "#f4cb0e"
- value: 40
color: "#2eda00"
- value: 65
color: "#f4cb0e"
- value: 90
color: "#ff1200"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- sensor.airly_cisnienie
name: Ciśnienie
color_thresholds:
- value: 950
color: "#057928"
- value: 1010
color: "#33d612"
- value: 1020
color: "#e5ce0f"
- value: 1030
color: "#ffa70f"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
Zauważyłem, że wysypała mi się integracja Airly, poprawiłem ale wychodzi że od 10 grudnia nie odpytuje. Pokazuję mi komunikat błąd 429 co powiązane jest z przekroczeniem odpytywania ale on się nie zeruje co 24h?
Narazie poprawiłem kod, uruchamiałem HA ponownie ,próba ponownej konfiguracji kończy się fiaskiem przy podaniu klucza API, i reszty danych po kliknięciu “dalej” klucz znika ,szerok. i długść geograf. zostają i nic dalej się niedzieje.
Witam, jak wyciągnąć atrybut advice
z encji sensor.airly
. Mam go w atrybutach
current:
fromDateTime: '2025-01-27T08:23:59.443Z'
tillDateTime: '2025-01-27T09:23:59.443Z'
values:
- name: PM1
value: 9.56
- name: PM25
value: 15.53
- name: PM10
value: 17.72
- name: PRESSURE
value: 1011.78
- name: HUMIDITY
value: 83.19
- name: TEMPERATURE
value: 5.42
indexes:
- name: AIRLY_CAQI
value: 25.88
level: LOW
description: Cóż... Bywało lepiej.
advice: Dzisiaj jest dobre i czyste powietrze!
color: '#D1CF1E'
standards:
- name: WHO
pollutant: PM10
limit: 45
percent: 39.38
averaging: 24h
- name: WHO
pollutant: PM25
limit: 15
percent: 103.52
averaging: 24h
friendly_name: Airly
ale nigdzie się nie pokazuje jako encja.
Wystarczy czasami poszukać także na forum - lupka w prawym górnym rogu ekranu - wpisując słowo “atrybut” - np. Zamiana atrybutu encji w osobną encję.
Gdyby to było takie proste, próbowałem na różne sposoby wyciągnąć sam atrybut z encji ale okazuje się, że Airly opis decription
i advice
traktuje inaczej. Poniżej działająca konfiguracja dla zainteresowanych.
sensor:
- platform: rest
scan_interval: 900
name: Airly
resource: xxxxxxxxxxx
value_template: "{{ value_json['current']['indexes'][0]['level'] }}"
headers:
apikey: xxxxxxxxxxxxxx
Accept-Language: pl
json_attributes:
- current
- platform: template
sensors:
airly_description:
friendly_name: "Opis powietrza"
value_template: >
{{ state_attr('sensor.airly', 'current')['indexes'][0]['description'] }}
icon_template: mdi:comment-text
airly_advice:
friendly_name: "Porada dotycząca powietrza"
value_template: >
{{ state_attr('sensor.airly', 'current')['indexes'][0]['advice'] }}
icon_template: mdi:lightbulb-on
airly_quality:
friendly_name: "Jakość powietrza"
value_template: >
{{ state_attr('sensor.airly', 'current')['indexes'][0]['level'] }}
icon_template: mdi:quicktime
airly_level:
friendly_name: "Poziom"
value_template: >
{{ state_attr('sensor.airly', 'current')['indexes'][0]['value'] }}
unit_of_measurement: "CAQI"
icon_template: mdi:database
airly_pm1:
friendly_name: "PM1"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][0]['value'] }}
unit_of_measurement: "µg/m³"
icon_template: mdi:weather-dust
airly_pm25:
friendly_name: "PM2.5"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][1]['value'] }}
unit_of_measurement: "µg/m³"
icon_template: mdi:weather-dust
airly_pm10:
friendly_name: "PM10"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][2]['value'] }}
unit_of_measurement: "µg/m³"
icon_template: mdi:weather-dust
airly_pressure:
friendly_name: "Ciśnienie"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][3]['value'] }}
unit_of_measurement: "hPa"
icon_template: mdi:gauge
airly_humidity:
friendly_name: "Wilgotność"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][4]['value'] }}
unit_of_measurement: "%"
icon_template: mdi:water-percent
airly_temperature:
friendly_name: "Temperatura"
value_template: >
{{ state_attr('sensor.airly', 'current')['values'][5]['value'] }}
unit_of_measurement: "°C"
icon_template: mdi:thermometer
i do tego karta lowelace
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:button-card
entity: sensor.airly_level
aspect_ratio: 3/1
color_type: card
show_state: true
show_label: true
show_icon: false
label: |
[[[
return "<b>CZYSTOŚĆ POWIETRZA</b></br>Poziom: " +
states['sensor.airly_quality'].state + "</br>" +
states['sensor.airly_description'].state + "</br>" +
states['sensor.airly_advice'].state;
]]]
styles:
grid:
- grid-template-areas: " \"s l\" \"s l\" "
- grid-template-columns: 30% 75%
label:
- white-space: normal
- font-size: 14px
- justify-self: center
- margin-left: 10%
- margin-top: 2%
state:
- font-size: 18px
- font-weight: bold
- justify-self: center
- align-self: start
- margin-left: 35%
- margin-top: 20%
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
}
- type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- entity: sensor.airly_pm25
type: attribute
attribute: percent
unit: "%"
- entity: sensor.airly_pm25
show_graph: true
show_state: true
show:
icon: false
color_thresholds:
- value: 20
color: "#68c920"
- value: 50
color: "#d35400"
- value: 70
color: "#ff1200"
line_width: 4
font_size: 50
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- entity: sensor.airly_pm10
type: attribute
attribute: percent
unit: "%"
- entity: sensor.airly_pm10
show_graph: true
show_state: true
show:
icon: false
color_thresholds:
- value: 20
color: "#68c920"
- value: 50
color: "#d35400"
- value: 70
color: "#ff1200"
line_width: 4
font_size: 50
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- sensor.airly_pm1
show:
icon: false
color_thresholds:
- value: 10
color: "#68c920"
- value: 30
color: "#d35400"
- value: 60
color: "#ff1200"
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- sensor.airly_temperature
name: Temperatura
color_thresholds:
- value: -7
color: "#157feb"
- value: 0
color: "#4dd2fd"
- value: 5
color: "#2ae96d"
- value: 10
color: "#2ae96d"
- value: 15
color: "#e2e92a"
- value: 20
color: "#e9d02a"
- value: 25
color: "#f7b923"
- value: 30
color: "#f79623"
- value: 35
color: "#f75a23"
- value: 40
color: "#f75a23"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: horizontal-stack
cards:
- type: custom:mini-graph-card
entities:
- sensor.airly_humidity
name: Wilgotność
color_thresholds:
- value: 5
color: "#f4cb0e"
- value: 40
color: "#2eda00"
- value: 65
color: "#f4cb0e"
- value: 90
color: "#ff1200"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}
- type: custom:mini-graph-card
entities:
- sensor.airly_pressure
name: Ciśnienie
color_thresholds:
- value: 950
color: "#057928"
- value: 1010
color: "#33d612"
- value: 1020
color: "#e5ce0f"
- value: 1030
color: "#ffa70f"
show:
icon: false
line_width: 4
font_size: 65
font_size_header: 12
hours_to_show: 240
points_per_hour: 3
style: |
ha-card {
box-shadow: 0px 0px 3px 1px var(--state-icon-color);
background: var(--card-background-color)
}