Home Assistant thinks I live in China--but I live in Arizona

I’ve just begun dabbling in Home Assistant and I am starting to get the hang of basic automations for my Philips Hue lights. However, after pulling my hair out all evening trying to figure out why a few sunset triggers aren’t working I think I’ve narrowed it down to an incorrect location setting. On my states page if I click the sun icon it tells me the sun will be setting in 6 hrs even though it set 3 hrs ago! Clearly something is amiss.

I have already updated my configuration.yaml as follows:

homeassistant:

Name of the location where Home Assistant is running

name: Home

Location required to calculate the time the sun rises and sets

latitude: 33.######
longitude: -111.######

Impacts weather/sunrise data (altitude above sea level in meters)

elevation: 381

metric for Metric, imperial for Imperial

unit_system: imperial

Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones

time_zone: America/Phoenix

since this didn’t work I found others have suggested creating a new zone so I have also added the follow to the same file:

zone:

  • name: Home
    latitude: 33.######
    longitude: -111.######
    radius: 100
    icon: mdi:account-multiple

I’ve done multiple restarts etc to no avail. I’m at a loss to figure out why this thing still thinks I’m halfway around the world…It seems rather clear to me that my longitude is for some reason being identified and 111 degrees East vs the 111 West where I really am.

Does anyone have any suggestions on how to get on the right track with this? For now I am hard coding specific times which work but I would really like to have the option to use the sun component.

Thanks,

Darren

How did you install HA?

Is your system clock time correct?

HA was installed onto a SD card that is placed in a Raspberry Pi 3 B following the tutorial on this site. I’m not sure about the system time on the raspberry pi but will check when I get home. I thought entering lat/long would override any other settings.

Also of note, the time appears to be correct and any automation I add that pertains to a specific time is executed at the proper time. It is only sun components that create issues.

Your configuration.yaml file should look like this, and work.

By default the home zone is specified as the lat/lon provided in this configuration unless you override it by specifying another home zone. However sunrise/set times are based on the configuration location, not specific zones.

homeassistant:
  name: Home
  latitude: 33.26
  longitude: -111.95
  elevation: 381.0
  unit_system: imperial
  time_zone: America/Phoenix

Also try adding a date/time sensor to your system so you can tell what it thinks the current time and date are.

If this is wrong, then it’s a path to go down for fixing, but if it’s the right date and time I can’t think of what might be causing your issue.

Hmm that’s really strange because that’s exactly what my configuration file looks like. Aside from the commented lines from the default file. Just to make sure, for a West longitude I am only supposed to use one - (dash/hyphen/minus sign or whatever else you want to can it). Is this correct?

As I said before it looks like an issue with east vs west longitude but I have no idea why it isn’t taking the negative number as westerly.

I tried adding a date and time component but couldn’t get it to show up and gave up last night. Maybe this is related because it sure seemed simple enough to add a few lines but I could never get it to display. Any chance someone could share a simple example of what to do?

Thanks again!

You can test your lat/long by putting the numbers in google maps. For example I put 33,-111 in google maps and it is certainly in Arizona.

I suspect you might have some indentation wrong. Please post your settings properly per the top of the page.

Here is what I have…

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 33.######
  longitude: -111.######
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 381
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Phoenix
  # Customization file
  customize: !include customize.yaml

Lat and long decimal places edited for privacy…

Well wouldn’t you know it, as I’m working to get the date/time sensor working I restart HA and low and behold when it comes back up everything works. Sunset looks right, I click on map and it centers over my house, the date and time sensor is working, all is well.

I’d like to thank everyone for replying with helpful ideas. I’m not quite sure what happened but I’m glad things are working now.

1 Like

In case this was the issue, a change to configuration.yaml generally requires home assistant to be restarted.