simonhq / accu_allergies

HA allergy sensors from AccuWeather
20 stars 2 forks source link

Some sensors still have "unknown" values. #19

Open JaroslawPrzybyl opened 1 year ago

JaroslawPrzybyl commented 1 year ago

Unfortunately I have to ask for help, because I'm able to get only few values from acc sensors (like playing golf or running), these most useful are still "unavailable": image

My Config: `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: "264625" URL_CITY: "marki" URL_COUNTRY: "PL" URL_LANG: "PL" URL_POSTCODE: "" WEB_VER: "" # or use "APRIL22"
' https://www.accuweather.com/pl/pl/marki/264625/health-activities/264625

Log from AppDaemon: 2023-02-21 14:16:02.176503 INFO AppDaemon: Reading config 2023-02-21 14:16:02.299401 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified 2023-02-21 14:16:02.305759 INFO AppDaemon: App 'accu_allergies' changed 2023-02-21 14:16:02.310153 INFO AppDaemon: Found 3 total apps 2023-02-21 14:16:02.341239 INFO AppDaemon: Terminating accu_allergies 2023-02-21 14:16:02.344157 INFO AppDaemon: Initializing app accu_allergies using class Get_Accu_Allergies from module accu_allergies 2023-02-21 14:16:05.426348 WARNING accu_allergies: accu_allergies: Entity input_boolean.get_allergies_data not found in namespace default 2023-02-21 14:16:05.430358 WARNING accu_allergies: accu_allergies: Entity input_boolean.reset_allergies_sensor not found in namespace default 2023-02-21 14:16:05.438806 WARNING AppDaemon: Excessive time spent in utility loop: 3269.0ms, 3269.0ms in check_app_updates(), 0.0ms in other

I tried also with small letters in country and lang code - no difference, APRIL22 - errors in appdaemon log (KeyError: 'health'), I have no idea what else could I check.

Ricks88 commented 1 year ago

Use WEB_VER: "APRIL22"

JaroslawPrzybyl commented 1 year ago

As I wrote, "APRIL22" gives an error in appdaemon log:

2023-02-21 15:53:03.897333 INFO AppDaemon: Reading config 2023-02-21 15:53:04.032497 INFO AppDaemon: /config/appdaemon/apps/apps.yaml added or modified 2023-02-21 15:53:04.039744 INFO AppDaemon: App 'accu_allergies' changed 2023-02-21 15:53:04.044526 INFO AppDaemon: Found 3 total apps 2023-02-21 15:53:04.073310 INFO AppDaemon: Terminating accu_allergies 2023-02-21 15:53:04.075833 INFO AppDaemon: Initializing app accu_allergies using class Get_Accu_Allergies from module accu_allergies 2023-02-21 15:53:04.104174 WARNING accu_allergies: ------------------------------------------------------------ 2023-02-21 15:53:04.105563 WARNING accu_allergies: Unexpected error running initialize() for accu_allergies 2023-02-21 15:53:04.106786 WARNING accu_allergies: ------------------------------------------------------------ 2023-02-21 15:53:04.117729 WARNING accu_allergies: Traceback (most recent call last): File "/usr/lib/python3.10/shelve.py", line 111, in getitem value = self.cache[key] KeyError: 'health' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 165, in initialize_app await utils.run_in_executor(self, init) File "/usr/lib/python3.10/site-packages/appdaemon/utils.py", line 337, in run_in_executor response = future.result() File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 124, in initialize self.load_sensors() File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 220, in load_sensors self.get_vals(self.url_txt_sets[0][1]) File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 258, in get_vals html_info = allergies_db[txt] File "/usr/lib/python3.10/shelve.py", line 113, in getitem f = BytesIO(self.dict[key.encode(self.keyencoding)]) KeyError: b'health' 2023-02-21 15:53:04.119841 WARNING accu_allergies: ------------------------------------------------------------

JaroslawPrzybyl commented 1 year ago

any chance for help?

simonhq commented 1 year ago

Hi Jaro,

You definitely need to use APRIL22, but it appears that the system is trying to populate the UI before it has downloaded the data.

The system downloads the data and stores it into a 'shelf' file once, and then it then reads that file each time it reloads the UI (this reduces the calls to the website when you do restarts).

I think what has happened is that you may have loaded the data without the APRIL22 flag the first time, and then you added it in, and so each time you reload it that day, it is reusing the 'shelf' that doesn't have the data required to load the UI with anything useful.

It may be worth, removing (ensuring that the shelf file is removed) and then resetting up the whole thing and ensuring you use the APRIL22 flag.

I need to look at a few things for this codeset, so I will see if there is a way to make this fail a little more gracefully.

Let me know how you go

Simon.

warrentc3 commented 1 year ago

Hi @simonhq, I tried the above recommendation and am still having issues.

2023-03-23 19:48:58.373501 WARNING accu_allergies: Unexpected error running initialize() for accu_allergies 2023-03-23 19:48:58.373903 WARNING accu_allergies: ------------------------------------------------------------ 2023-03-23 19:48:58.376155 WARNING accu_allergies: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 165, in initialize_app await utils.run_in_executor(self, init) File "/usr/lib/python3.10/site-packages/appdaemon/utils.py", line 337, in run_in_executor response = future.result() File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 131, in initialize self.load_sensors() File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 227, in load_sensors self.get_vals(self.url_txt_sets[0][1]) File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 278, in get_vals ticon = 'mdi:' + self.icon_txt_set[val.text] KeyError: 'Tree Pollen' 2023-03-23 19:48:58.376556 WARNING accu_allergies: ------------------------------------------------------------ 2023-03-23 19:48:58.377626 INFO AppDaemon: App initialization complete

rononline commented 1 year ago

I think i have the same problem, already removed everything, and reinstalled.

2023-03-23 21:41:38.188318 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2023-03-23 21:41:38.188846 INFO AppDaemon: Adding /config/appdaemon/apps/accu_allergies to module import path
2023-03-23 21:41:38.192368 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/telegram.py
2023-03-23 21:41:38.222599 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/accu_allergies/accu_allergies.py
2023-03-23 21:41:39.239869 INFO AppDaemon: Initializing app bot using class TelegramBot from module telegram
2023-03-23 21:41:39.242611 INFO AppDaemon: Initializing app accu_allergies using class Get_Accu_Allergies from module accu_allergies
2023-03-23 21:41:39.492332 INFO accu_allergies: sensor.acc_boompollen_today
2023-03-23 21:41:39.493484 WARNING accu_allergies: ------------------------------------------------------------
2023-03-23 21:41:39.494331 WARNING accu_allergies: Unexpected error running initialize() for accu_allergies
2023-03-23 21:41:39.494685 WARNING accu_allergies: ------------------------------------------------------------
2023-03-23 21:41:39.496386 WARNING accu_allergies: Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/appdaemon/app_management.py", line 165, in initialize_app
    await utils.run_in_executor(self, init)
  File "/usr/lib/python3.10/site-packages/appdaemon/utils.py", line 337, in run_in_executor
    response = future.result()
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 131, in initialize
    self.load_sensors()
  File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 227, in load_sensors
    self.get_vals(self.url_txt_sets[0][1])
  File "/config/appdaemon/apps/accu_allergies/accu_allergies.py", line 278, in get_vals
    ticon = 'mdi:' + self.icon_txt_set[val.text]
KeyError: 'Boompollen'
2023-03-23 21:41:39.496791 WARNING accu_allergies: ------------------------------------------------------------
2023-03-23 21:41:39.497788 INFO AppDaemon: App initialization complete
2023-03-23 21:41:39.964622 INFO AppDaemon: New client Admin Client connected

Don't know where to look ..

simonhq commented 1 year ago

Sorry all,

I thought I was being clever, and added in an improvement that only works for English, I have hopefully tidied this up now, apologies.

Simon.

rononline commented 1 year ago

That did it @simonhq! It works now! Thanks!