Understanding - openuv invalid API

Hi folks,
I have a question.
I’ve recently implemented the openuv integration.
It’s great. I understand there’s a 50 requests per day limit in the free version.
I used to get data, then I suspect I hit my limit, I subsequently saw ‘unavailable’ in my entity states.
I’m updating per the guide - with the exception of updating /1 hour and between the hours of 10:00:00 and 15:00:00 (I had some trouble with using the sun.sun settings).

All of the data relating to openuv is now ‘unavailable’.
When I check the logs I see:

Log Details (ERROR)
Thu Feb 13 2020 14:00:03 GMT+1000 (Australian Eastern Standard Time)
Error during uv index data update: Invalid API key

I’ve generated a new API key for good measure - pretty sure it’s right.
My automations are:

- id: '1581269926610'
  alias: UVIndexUpdate
  description: Update OpenUV every hour while the sun is at least 10 degrees above
    the horizon
  trigger:
  - hours: /1
    platform: time_pattern
  condition:
  - after: '10:00:00'
    before: '15:00:00'
    condition: time
  action:
  - service: openuv.update_uv_index_data
- id: '1581303230274'
  alias: UpdateOpenUVData
  description: Update OpenUV every hour during the daytime
  trigger:
  - hours: /1
    platform: time_pattern
  condition:
  - after: '10:00:00'
    before: '15:00:00'
    condition: time
  action:
  - service: openuv.update_data
- id: '1581303318832'
  alias: UpenUVProtectionWindowUpdate
  description: Update OpenUV protection window once a day
  trigger:
  - at: 02:10:00
    platform: time
  condition: []
  action:
  - service: openuv.update_protection_data

There isn’t ANY valid data at all over a 24hr period…
I’m sure I’m doing something silly, but can’t see what…

I think there have been issues with their server - it was generating server errors and complaining about “mongodb” issues yesterday.

Great to know.
Appreciate it.
I’ll sit tight for a bit.

fyi, has refreshed multiple times for me in the last 24 hours.

Doh!
Has it worked all along? Or has it come good over the last 24 hours?
I deleted the integration.
Generated a new key- still no joy.
I’ve contacted the developer, about a day ago.
My config is pretty straight forward, I can’t get any requests to go through.

not sure - I restarted HA for other reasons.

I’ve currently got openuv configured via configuration.yaml:

openuv:
  api_key: blahblahblahblahblahblahblahblahblah

and an automation:

- alias: Update OpenUV every 30 minutes during the daytime
  trigger:
    platform: time_pattern
    minutes: '/60'
  condition:
    condition: and
    conditions:
      - condition: sun
        after: sunrise
      - condition: sun
        before: sunset
  action:
    service: openuv.update_data

As I said, there were definitely server issues over weekend, but I don’t have issues now.

I’ve just removed mine, restarted, and added again.
I’ve duplicated your update automation for good measure.
Fingers crossed.

Cheers,

Still have an invalid API key - i wonder if I have funny control characters doing stupid things… It’s not complex at all…

No cigar - same error. I wonder if I’ve got some remnant config somewhere, or perhaps HA has that I don’t know about…
Bummer.

I there are two ways to integrate openuv - configuration.yaml and direct in the integration GUI - I’d make sure you delete the integration version. Also check using curl that your API key is still valid:

curl -X GET \
'https://api.openuv.io/api/v1/uv?lat=-33.34&lng=115.342' \
-H 'x-access-token: **Your_API_Key**'

Thanks for the info - strangely the curl works okay from the box the doccker is running on - so I guess the API works fine after all.
I can’t find any reference to OpenUV in the integration GUI. I’ve only ever enabled in my config.yaml.
Is there a global search I can do via cli or something?

Dumb question:
Do I need the x-access-token reference in my config.yaml as part of my api_key: entry?
i.e.

openuv:
  api_key: "x-access-token: APIKEYHERE" 

Odd…

nope - just

openuv:
  api_key: blahblahblahblahblahblahblahblahblah

Are there any strange chars in your api key?

Have you checked the log to see the detailed errors?
(grep -i openuv /var/log/syslog on my system, yours may be different)

I’ll look at the more detailed looged. thanks for the tip.
I’ve been simply copying and pasting from the web for the AP I key.
I’ll do it via notepad to remote any unwanted characters.

Thanks again.

Right,
I’ve added the OpenUV integration via the Lovelace GUI. I’d never done that before.
And holy cow it works!
I’m now seeing _2 on all of my working entities.
So where I had sensor.current_ozone_level (which is unavailable) I now have an additional sensor.current_ozone_level_2 which is working.
I clearly still have the OpenUV integration configured somewhere, but for the life of me I don’t know where.
It’s definitely commented out in my configuration.yaml.
I’ve restarted HA a number of times for good measure (and also updated this morning).

if it works, who cares why

(ok - we all do, but it can wait :slight_smile: )

:laughing:
That’s fair enough in the scheme of things.
I don’t like seeing errors in my log file though.
This is something I will eventually learn to to cope with :slight_smile:

I do appreciate your ongoing assistance.
You and everyone in this community are stellar.

did you get it working?

I have two instances of this integration now - one that works and one that does not.
The original (enabled from my config.yaml) failed, is still present and returns unknown for all entities.
The second one which I enabled via the GUI works okay with daily updates functioning as expected.
I can’t seem to remove the original one - I’ve removed it from my config file, restarted, etc. It persists.

Ps. Thank you for checking. :slight_smile:

I added OpenUV from HACS but it does not update the data automatically. Any ways to fix it? I would need half hour updates down in the hot and sunny south

mine:

- alias: Update OpenUV every hour during the daytime
  id: openuv__update_hourly
  trigger:
    platform: time_pattern
    minutes: "/30"
  condition:
    condition: and
    conditions:
      - condition: sun
        after: sunrise
      - condition: sun
        before: sunset
  action:
    service: openuv.update_data