simonhq / accu_allergies

HA allergy sensors from AccuWeather
20 stars 2 forks source link

Getting sensors Unknown - Tried a couples solutions #21

Closed MrDrew514 closed 1 year ago

MrDrew514 commented 1 year ago

Hello there, first of all, thanks for all the time you are putting in this.

I've been trying to set this up but all the sensors are showing as unavailable excep for the sensor.acc_data_last_sourced , sensor.acc_air_today and sensor.acc_air_tomorrow. The others are showing as Unknown.

I have been going through the other issues and I've tried a couples of locations that people have posted claiming it was working but I could not get it work on my end.

The two binary sensors are working proprely.

When I use the "APRIL22" tag, I get an Initialize error with appdaemon.

here is my config for this url: https://www.accuweather.com/en/ca/ville-marie/h3a/current-weather/3556365

accu_allergies:
  module: accu_allergies
  class: Get_Accu_Allergies
  ACC_FILE: "./allergies"
  ACC_FLAG: "input_boolean.get_allergies_data"
  DEB_FLAG: "input_boolean.reset_allergies_sensor"
  URL_ID: "3556365"
  URL_CITY: "ville-marie"
  URL_COUNTRY: "ca"
  URL_LANG: "en"
  URL_POSTCODE: ""
  WEB_VER: ""

Here is my appdaemon log

2023-08-18 08:36:58.562309 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/cold-flu-weather/3556365?name=flu -- 2023-08-18 08:36:58.158340 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/cold-flu-weather/3556365?name=common-cold 2023-08-18 08:36:57.637749 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/allergies-weather/3556365?name=dust-dander 2023-08-18 08:36:57.304974 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/allergies-weather/3556365?name=mold 2023-08-18 08:36:56.962085 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/allergies-weather/3556365?name=tree-pollen 2023-08-18 08:36:56.449461 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/allergies-weather/3556365?name=grass-pollen 2023-08-18 08:36:56.009527 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/allergies-weather/3556365?name=ragweed-pollen 2023-08-18 08:36:55.619926 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/air-quality-index/3556365 2023-08-18 08:36:55.321393 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/sinus-weather/3556365 2023-08-18 08:36:54.965883 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/migraine-weather/3556365 2023-08-18 08:36:54.513267 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/arthritis-weather/3556365 2023-08-18 08:36:52.681488 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/3556365/asthma-weather/3556365 2023-08-18 08:34:46.659239 INFO AppDaemon: Calling initialize() for accu_allergies 2023-08-18 08:34:46.658181 INFO AppDaemon: Loading app accu_allergies using class Get_Accu_Allergies from module accu_allergies 2023-08-18 08:34:46.656355 INFO AppDaemon: Reloading Module: /conf/apps/accu_allergies.py 2023-08-18 08:34:46.655390 INFO AppDaemon: Terminating accu_allergies

Thank you again. Hopefully I can get this to work,

simonhq commented 1 year ago

Hi Drew,

You definitely need the APRIL22 flag, but you also need to put in the postcode

for this https://www.accuweather.com/en/ca/ville-marie/h3a/current-weather/3556365

en is the language ca is the country ville-marie is the city h3a is the postcode 3556365 is the ID

so your block should look like this:

accu_allergies:
  module: accu_allergies
  class: Get_Accu_Allergies
  ACC_FILE: "./allergies"
  ACC_FLAG: "input_boolean.get_allergies_data"
  DEB_FLAG: "input_boolean.reset_allergies_sensor"
  URL_ID: "3556365"
  URL_CITY: "ville-marie"
  URL_COUNTRY: "ca"
  URL_LANG: "en"
  URL_POSTCODE: "h3a"
  WEB_VER: "APRIL22"

you only leave the postcode out if it is the same as the ID

hope this helps,

Simon

MrDrew514 commented 1 year ago

Thank you for the help so I re-generated the appdaemon container to fix this and it worked partially. I'm now getting a bunch of sensors like this : image image

but the pollen sensors are still showing as unknown, do you have an idea why?

image image

these are the two lines generated by the logs when I turn on the getdata switch:

2023-08-19 05:28:32.662684 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/h3a/air-quality-index/3556365 2023-08-19 05:28:32.383412 INFO accu_allergies: request https://www.accuweather.com/en/ca/ville-marie/h3a/health-activities/3556365
MrDrew514 commented 1 year ago

After checking the website, Im guessing that they changed their data and that allergies is now , am I right?

Thanks again.

simonhq commented 1 year ago

Hey Drew,

The pre-APRIL22 and APRIL22 versions of the code (and the accu website) produced different sensors, and once a sensor has been created it will stay until you remove it. If you go to the actual page

https://www.accuweather.com/en/ca/ville-marie/h3a/health-activities/3556365

you will see the values available on it, and the grass and ragweed pollens are not there, so those sensors are not being gotten, and are just hold overs of the old code. It is a pity as it was the pollen values that I originally wanted to get but are not being reported by accuweather any more.

so easy answer, you can remove those sensors, or at least remove them from your UI as they will not be updated.

Simon.

MrDrew514 commented 1 year ago

Great, thank you!