OpenHab3: Czy i jak...
 
Powiadomienia
Wyczyść wszystko

OpenHab3: Czy i jak uruchomiliście może Airly?

24 Wpisów
5 Użytkownicy
6 Likes
2,487 Wyświetleń
adrian
(@adrian)
Wpisów: 3973
Szefu Admin Zasłużony dla Forum, Patron Strony
 

@goofas Mam ten sam problem, ale sposób w jaki ja pobieram dane z Airly rozwiązuje go. Jak ktoś to rozwiązał w inny sposób w OH3 to chętnie również skorzystam

image

Pozdrawiam, a.

 
Dodane : 03/12/2022 4:34 pm
goofas reacted
(@kamikac)
Wpisów: 226
Pomocny
 

@goofas Czytasz i wiesz: https://www.openhab.org/addons/bindings/http/

headers yes - Additional headers that are sent along with the request. Format is "header=value". Multiple values can be stored as headers="key1=value1", "key2=value2", "key3=value3",. When using text based configuration include at minimum 2 headers to avoid parsing errors.

więc może tak:

Thing http:url:airly "Airly: bridge" [ baseURL="https://airapi.airly.eu/v2/measurements/installation?installationId=2368&apikey=API", refresh=900, headers="Accept-Language=pl", ""]

Zadziałało?

 
Dodane : 11/12/2022 12:28 pm
(@goofas)
Wpisów: 29
Praktykant
 

@kamikac sprawdzałem kilka sposobów z manuali i nie udało mi się pobrać w pl, zatem skorzystałem z porad powyżej i pobieram sobie plik lokalnie i dopiero wtedy zaciągam do OH

 
Dodane : 11/12/2022 12:38 pm
adrian reacted
(@kamikac)
Wpisów: 226
Pomocny
 

U mnie działa po polsku w takiej konfiguracji:

Thing http:url:airly "Airly" [
	baseURL="https://airapi.airly.eu/v2/measurements/installation?installationId=40420",
	headers="Accept=application/json","apikey=APIkey","Accept-Language=pl",
	refresh=900 ] {
		Channels:
			Type number : cur_PM1 "akt. PM1"			[stateTransformation="JSONPATH:$.current.values[?(@.name=='PM1')].value" ]
			Type number : cur_PM25 "akt. PM2,5"			[stateTransformation="JSONPATH:$.current.values[?(@.name=='PM25')].value" ]
			Type number : cur_PM10 "akt. PM10" 			[stateTransformation="JSONPATH:$.current.values[?(@.name=='PM10')].value" ]
			Type number : cur_pressure "akt. ciśn"		[stateTransformation="JSONPATH:$.current.values[?(@.name=='PRESSURE')].value" ]
			Type number : cur_humidity "akt. wilg"		 [stateTransformation="JSONPATH:$.current.values[?(@.name=='HUMIDITY')].value" ]
			Type number : cur_temp "akt. temp" [stateTransformation="JSONPATH:$.current.values[?(@.name=='TEMPERATURE')].value" ]
			Type string : cur_desc "akt. opis" [stateTransformation="JSONPATH:$.current.indexes[?(@.name=='AIRLY_CAQI')].description" ]
			Type number : percent_WHO_PM25 "Proc. stand. WHO PM2,5" [stateTransformation="JSONPATH:$.current.standards[?(@.pollutant=='PM25')].percent" ]
			Type number : percent_WHO_PM10 "Proc. stand. WHO PM10" [stateTransformation="JSONPATH:$.current.standards[?(@.pollutant=='PM10')].percent" ]

}
 
Dodane : 12/12/2022 1:10 am
adrian reacted
Strona 2 / 2
Udostępnij: