Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant get this working #14

Open
techcubs opened this issue May 12, 2022 · 11 comments
Open

Cant get this working #14

techcubs opened this issue May 12, 2022 · 11 comments

Comments

@techcubs
Copy link

techcubs commented May 12, 2022

Hi All,

I set this up in HA and it was working fine, but now it doesn't show any data,
my app.yaml looks 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: "328298"
URL_CITY: "pinner"
URL_COUNTRY: "gb"
URL_LANG: "en"
URL_POSTCODE: "ha5-3"
WEB_VER: "APRIL22" # or use "APRIL22"

I also tried setting up the input_booleans but had no luck with that.
input_boolean.yaml looks like this (as i have this in my configuration.yaml input_boolean: !include input_boolean.yaml ):

load_allergies_data:

get_allergies_data:

and my 2 automations look like this

alias: Accuweather Allergies Data
description: ''
trigger:

  • platform: state
    entity_id:
    • input_boolean.get_allergies_data
      to: 'off'
      condition: []
      action:
  • service: input_boolean.turn_on
    target:
    entity_id: input_boolean.load_allergies_data
    data: {}
    mode: single

alias: Accuweather Get Allergies Data
description: ''
trigger:

  • platform: time
    at: '16:00:00'
  • platform: time
    at: '17:30:00'
    condition: []
    action:
  • service: input_boolean.turn_on
    data: {}
    target:
    entity_id: input_boolean.get_allergies_data
    mode: single

Anything i am doing wrong ?

@simonhq
Copy link
Owner

simonhq commented May 13, 2022

Hi Techcubs,

A few different things;

a) I don't think you need either of these automations, as long as you are happy only getting the data once per day in the morning. I would expect that it would be working ok for that run.

b) if you do want to get it more often, then 16:00 (4pm) and 17.30 (5.30pm) seem to be strange times, do you expected them to change much between 5.30am (auto run) and then the two other times?

c) If you are going to do the different times, your first automation needs to turn on the input_boolean that loads the data into the ui, which is your DEB_FLAG so it should be input_boolean.reset_allergies_sensor.

Everything else looks ok, are you getting any data at all?

Simon.

@techcubs
Copy link
Author

Thanks Simon for the quick reply.

The automation times are just me doing random test, ideally I would like it to report every 2 hours as we suffer a lot from the allergies. ( I am not sure how often accuweather change the allergy data though, if its only once a day then no point :) )

understood your points and will take them on board.

What I am getting now is just these sensors:
image

Everything else shows as unknown.

Raj

@simonhq
Copy link
Owner

simonhq commented May 13, 2022

Hey Raj,

Can you try the following;

First can you look it the developer tools (the hammer in the left sidebar in home assistant) and look to see if there are new sensors that start with acc_dust etc. , with the changes for APRIL22 the majority of the sensors were renamed, so you may just need to rebuild your ui with the new names.

If there aren't any new acc_ sensors try the following two different options

  1. Try removing your URL_POSTCODE, set it to ""

See if that helps, some places need the postcode others don't.


separately

  1. Try removing the WEB_VER, set it to ""

Your area may still be using the older version.

From what I can see looking at your area, these shouldn't matter, but lets get the simple stuff out of the way.

Simon

@techcubs
Copy link
Author

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: "328298"
URL_CITY: "pinner"
URL_COUNTRY: "gb"
URL_LANG: "en"
URL_POSTCODE: ""
WEB_VER: "" # or use "APRIL22"

Still everthing shows as unknown

@simonhq
Copy link
Owner

simonhq commented May 16, 2022

Hi Raj,

No, I really need you test each thing individually, go back to what you had in the config and go and see if there are new versions of the sensors - Not in your UI, in the states page.

If that doesn't work, try just removing the postcode, then check the sensors again (in the states page).

If that doesn't work, try removing the APRIL22, then check the sensors again (in the states page).

If you only look in your UI, they will keep showing as unknown as the new sensors have new names.

Simon.

@techcubs
Copy link
Author

how do I check on demand? Please can you check if these Automations are now correct.

alias: Accuweather Get Allergies Data
description: ''
trigger:

  • platform: time
    at: '14:00:00'
  • platform: time
    at: '17:30:00'
    condition: []
    action:
  • service: input_boolean.turn_on
    data: {}
    target:
    entity_id: input_boolean.reset_allergies_sensor
    mode: single

alias: Accuweather Load Allergies Data
description: ''
trigger:

  • platform: state
    entity_id:
    • input_boolean.get_allergies_data
      to: 'off'
      condition: []
      action:
  • service: input_boolean.turn_on
    target:
    entity_id: input_boolean.load_allergies_data
    data: {}
    mode: single

RE: the sensors, i did check them in the developer tool:

image

@simonhq
Copy link
Owner

simonhq commented May 18, 2022

Ok a few things to make this easier.

so when you put in code - select it and press ctrl+e (the <> button on the bar above) that it formats it as code, so I can read it a little easier.

Until we get the basics working, then these extra automations aren't important, so lets try and get the basics working.

(but no they aren't correct, you need to 'get' the data at a time (get turn on), and then 'reset' the ui (reset turns on) once it has got the data (get turns off), I don't know why you are turning on the 'load' one - does it even exist? it isn't in your config)

When I check my sensors for the filter 'acc_d' I see this:

image

so if you have the WEB_VER: "APRIL22" set, then yours is not working at all, as the sensors you are showing are for the old version only.

so lets go back to here:

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: "328298"
  URL_CITY: "pinner"
  URL_COUNTRY: "gb"
  URL_LANG: "en"
  URL_POSTCODE: ""
  WEB_VER: "APRIL22" # or use "APRIL22"

this is the minimum you should have in you apps.yaml file.

also please confirm that you have created the two helpers as without these it won't do anything:

input_boolean.get_allergies_data
input_boolean.reset_allergies_sensor

If this is all correct and you still aren't getting the sensors, then I'll have to think of something else.

Simon.

@Sandersjr1
Copy link

Sandersjr1 commented Jun 3, 2022

Hi having the same issues.

Everything comes back as unknown either way but this error could

Hope this login the AppDaemon can help. Added info using to help debug.

#--Config.yaml
input_boolean:
get_allergies_data:
name: get_allergies_data
icon: mdi:toggle-switch
reset_allergies_sensor:
name: reset_allergies_sensor
icon: mdi:toggle-switch

#--apps.yaml
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: "346069"
URL_CITY: "college-station"
URL_COUNTRY: "us"
URL_LANG: "en"
URL_POSTCODE: ""
WEB_VER: "APRIL22" # or use "APRIL22"

2022-06-03 18:00:22.052350 INFO AppDaemon: Initializing app accu_allergies using class Get_Accu_Allergies from module accu_allergies
2022-06-03 18:00:22.055117 WARNING accu_allergies: ------------------------------------------------------------
2022-06-03 18:00:22.055264 WARNING accu_allergies: Unexpected error running initialize() for accu_allergies
2022-06-03 18:00:22.055396 WARNING accu_allergies: ------------------------------------------------------------
2022-06-03 18:00:22.055733 WARNING accu_allergies: Traceback (most recent call last):
File "/usr/lib/python3.9/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.9/site-packages/appdaemon/app_management.py", line 165, in initialize_app
await utils.run_in_executor(self, init)
File "/usr/lib/python3.9/site-packages/appdaemon/utils.py", line 337, in run_in_executor
response = future.result()
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, 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.9/shelve.py", line 113, in getitem
f = BytesIO(self.dict[key.encode(self.keyencoding)])
KeyError: b'health'
2022-06-03 18:00:22.055873 WARNING accu_allergies: ------------------------------------------------------------

@simonhq
Copy link
Owner

simonhq commented Jun 4, 2022

Hi it appears that the original fetch from is not working correctly.

Looking at your area webpage try the following:

#--apps.yaml

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: "77840"
  URL_CITY: "college-station"
  URL_COUNTRY: "us"
  URL_LANG: "en"
  URL_POSTCODE: "346069"
  WEB_VER: "APRIL22"

I would suggest restarting appdaemon after making this change and see what is happening.

Simon

@techcubs
Copy link
Author

techcubs commented Jun 21, 2022

input_boolean:
get_allergies_data:
name: get_allergies_data
icon: mdi:toggle-switch
reset_allergies_sensor:
name: reset_allergies_sensor
icon: mdi:toggle-switch

ok, i finally had the chance to make changes:

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: "328298"
  URL_CITY: "pinner"
  URL_COUNTRY: "gb"
  URL_LANG: "en"
  URL_POSTCODE: "ha5-3"
  WEB_VER: "APRIL22" # or use ""
  #https://www.accuweather.com/en/gb/pinner/ha5-3/weather-forecast/328298

input_booloean.yaml

get_allergies_data:
  name: get_allergies_data
  icon: mdi:toggle-switch

reset_allergies_sensor:
  name: reset_allergies_sensor
  icon: mdi:toggle-switch

and when i restarted App Daemon, i now have these values:
image

But i wanted to have the Today an tomorrow values with the phrases as well because i use them in HA. So, i removed the "April 2022" and now all values are back to "unknown"
image

@simonhq
Copy link
Owner

simonhq commented Jun 21, 2022

Hi Tech,

Once your area has been changed over by Accu then you have to use the APRIL22 version, the other information is no longer being published by them.

The new website (their changes not mine) mean that there are no tomorrow values any more, thus I have stopped trying to copy them.

The only reason that in the last screen shot you have shown that things like sensor.acc_composting_today are still showing 'Fair' and not unknown is that the older version didn't try to write them, meaning that it isn't being populated, leaving the 'Fair' and it will continue to be 'Fair' forever if you didn't rerun with the 'APRIL22' flag on.

All my system does is copy what they put on their website, if there is something else on there that you want, we may be able to copy it down, but it depends upon how they have formatted their website, and if I can effectively decipher what they are publishing.

Hope this helps,

Simon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants