I recently wrote about how to show bin collection information in Home Assistant, and my next project was to pull some air quality information. Fortunately I have a ‘Tado’ account which meant I could pull this information from their API کے using the following code
20-دسمبر-2021 کو اپ ڈیٹ ہوا۔
This was updated to tweak an issue where home assistant converts the text value “none” into “unknown”.
Much of the information for this was taken from a thread on the home assistant forums, but I was able to add pollution as well as pollen information, and I also had to tweak the code to resolve an issue with “none” being treated as “unknown” rather than as a string of text. Lots of credit to Drillbit on the forums though.
ٹیڈو اکاؤنٹ کی تفصیلات
- You will need some information for your Tado account
- Visit https://my.tado.com/api/v2/me?صارف نام_you@emailaddress.tld&پاس ورڈ = آپ کا پاس ورڈ
- Near the top of the output you need the numeric ID that is listed under homes: 0: ID:
- اگلے, کے پاس جاؤ https://www.latlong.net/ and locate your home and make a note of the latitude and longitude
- Next visit https://acme.tado.com/v1/homes/آپ کے گھر کی شناخت/ایئر تکلیف?عرض البلد =12.34&طول البلد =12.34&صارف نام =آپ کا ای میل&پاس ورڈ =your-password اس بات کا یقین کرنے کے لئے کہ یہ بوجھ ہے
ہوم اسسٹنٹ کے لئے کوڈ
- Add the following code to your configuration.yaml123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109sensor:- platform: rest# API call to get air quality# Result goes into outdoorQuality attribute in JSON formatname: TadoAirverify_ssl: truescan_interval: 1800resource: https://acme.tado.com/v1/homes/<em>your-home-ID</em>/airComfort?latitude=<em>12.34</em>&longitude=<em>12.34</em>&username=<em>your@email</em>&password=<em>your-password</em>headers:User-Agent: Home AssistantContent-Type: application/jsonmethod: GETjson_attributes:- roomMessages- outdoorQualityvalue_template: ‘Tado airComfort’# Enumerate JSON to populate various template sensors- platform: templatesensors:air_quality:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“aqi”][“level”] | capitalize }}’friendly_name: “Air Quality”icon_template: mdi:air-filterunique_id: “air_quality”# Pollen sensorsair_pollen_level:value_template: >{% if states(‘sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“dominant”][“level”]’) == ‘unknown’ %}None.{% else %}{{states(‘sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“dominant”][“level”]’)}}{% endif %}friendly_name: “Pollen Level”icon_template: mdi:flowerunique_id: “pollen_level”air_pollen_level_grass:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][0][“forecast”][0][“level”] | capitalize }}.’friendly_name: “Grass Pollen”icon_template: mdi:flowerunique_id: “grass_pollen_level”air_pollen_level_grass_tomorrow:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][0][“forecast”][1][“level”] | capitalize }}.’friendly_name: “Grass Pollen Tomo.”icon_template: mdi:flowerunique_id: “grass_pollen_level_tomorrow”air_pollen_level_weed:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][1][“forecast”][0][“level”] | capitalize }}.’friendly_name: “Plant Pollen”icon_template: mdi:sproutunique_id: “plant_pollen_level”air_pollen_level_weed_tomorrow:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][1][“forecast”][1][“level”] | capitalize }}.’friendly_name: “Plant Pollen Tomo.”icon_template: mdi:sproutunique_id: “plant_pollen_level_tomorrow”air_pollen_level_tree:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][2][“forecast”][0][“level”] | capitalize }}.’friendly_name: “Tree Pollen ”icon_template: mdi:treeunique_id: “tree_pollen_level”air_pollen_level_tree_tomorrow:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollens”][“types”][2][“forecast”][1][“level”] | capitalize }}.’friendly_name: “Tree Pollen Tomo.”icon_template: mdi:treeunique_id: “tree_pollen_level_tomorrow”air_pollution_level_pm10:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][0][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][0][“concentration”][“value”]}}μg/m³’friendly_name: “PM 10”icon_template: mdi:treeunique_id: “pollution_pm10”air_pollution_level_pm25:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][1][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][1][“concentration”][“value”]}}μg/m³’friendly_name: “PM 2.5”icon_template: mdi:treeunique_id: “pollution_pm25”air_pollution_level_ozone:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][2][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][2][“concentration”][“value”]}}ppb’friendly_name: “Ozone”icon_template: mdi:treeunique_id: “pollution_ozone”air_pollution_level_sulphur:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][3][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][3][“concentration”][“value”]}}ppb’friendly_name: “Sulphur Dioxide”icon_template: mdi:treeunique_id: “pollution_sulphur”air_pollution_level_carbon:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][4][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][4][“concentration”][“value”]}}ppb’friendly_name: “Carbon Monoxide”icon_template: mdi:treeunique_id: “pollution_carbon”air_pollution_level_nitrogen:value_template: ‘{{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][5][“level”] | capitalize }}: {{ states.sensor.tadoair.attributes[“outdoorQuality”][“pollutants”][5][“concentration”][“value”]}}ppb’friendly_name: “Nitrogen Dioxide”icon_template: mdi:treeunique_id: “pollution_nitrogen”
براہ کرم ذیل میں تبصرہ کرکے اپنے خیالات ہمیں بھیجیں! آپ کے سبسکرائب کرنا چاہتے ہیں تو سب سے اوپر دائیں مینو پر لنک سبسکرائب استعمال کریں. آپ بھی ذیل سماجی روابط کا استعمال کرتے ہوئے کی طرف سے اپنے دوستوں کے ساتھ اس کا اشتراک کر سکتے ہیں. چیرس.
CIao
stavo seguendo la tua guida. Ti risulta che la stringa di tado funzioni ancora? perchè mi restituisce errore {“message”:“User is not authorized to access this resource with an explicit deny”} oppure inserendola in versione codice yaml mi restituisce {“message”:“Token di autenticazione mancante”} . Grazie
Hi Flavio
جی ہاں, this is still working for me.
میرے یو آر ایل ہے https://acme.tado.com/v1/homes/123456/airComfort?latitude=11.11&longitude=11.11&username=me@myemail.com&password=mypassword
Obviously I’ve removed the home ID, latitude, longitude, email address, and password I use. But if you get those right then it should load fine
Have you double checked your email address and password? Have you checked your home ID at https://my.tado.com/api/v2/me?username=you@emailaddress.tld&password=yourpassword
I don’t know if the Tado system is different outside of the برطانیہ — maybe they don’t have data for latitude and longitude where you are? Do you get air quality data in your Tado app when you’re logged into your account?