Started with a fresh install of AppDaemon and now I get an error about latitude

Hello,

I had an old install of HASS and AppDaemon. I have HASS updated and working fine but AppDaemon is giving me issues.

If I do not set the latitude/longitude I get an error two errors. “Required attribute not set or obtainable from any plugin: latitude/longitude”

If I manually set the latitude/longitude in the config then I get a different error.

File "/usr/local/lib/python3.6/site-packages/appdaemon/admain.py", line 105, in run
loop.run_until_complete(asyncio.gather(*pending))
File "/usr/local/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
return future.result()
File "/usr/local/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 1389, in utility
self.init_sun()
File "/usr/local/lib/python3.6/site-packages/appdaemon/appdaemon.py", line 915, in init_sun
if -90 > latitude < 90:
TypeError: '>' not supported between instances of 'int' and 'str'

My latitude and longitude are not quoted in the config file. Both have 7 decimal places. Any ideas here?

Can you please show your configuration file? Which version of Appdaemon did you install? Are you using Hass.io?
The error looks like you put the latitude inside quotation marks and then it tries to compare a string to an integer, which of course is not possible.

Sure. I am running hass via the official docker. Appdaemon is running via docker as well, i used this container. acockburn/appdaemon. It is up to date. Here is my config.

appdaemon:
  logfile: STDOUT
  errorfile: STDERR
  threads: '10'
  elevation: 300,
  latitude: 52.3731339,
  longitude: 4.8903147,
  time_zone: America/New_York
  plugins: 
    HASS:
      type: HASS
      ha_url: redacted
      token: redacted
# Apps
hello_world:
  module: hello
  class: HelloWorld
HADashboard:
  dash_url: redacted

Remove the commas after the values for elevation, latitude and longitude.

Can we please forget that this conversation ever happened? Just like when I am debugging and I cannot figure out why if(i=0; i<10; i++) isnt working… The dreaded if loop… Been having a trying week with work so we will blame burned out brain on this. Will try fixing it again later and report back.

Thanks!

should be

if -90 < latitude < 90:

or

if latitude>-90 and latitude>90:

Good catch!

I opened an issue on Github for this.
https://github.com/home-assistant/appdaemon/issues/680

1 Like

Very good catch but surely

Is wrong too.?
How can a latitude be greater than 90 ?

Yes this formula is wrong as well, I wrote the correct one in the Git issue