[SOLVED] Weather location issue

Here is an interesting “location” bug
My newly built PiCroft is paired with my old account that has a linux version of Mycroft The location of all devices is “Winchester, UK” as is my account location.
Asking mycroft when it is get the response “I’m in Winchester, England, United, Kingdom”

When I ask “Andromeda what’s the weather” ( Andromeda is my name for my Mycroft!) I get:
“>> With a high of 26 and a low of 18,
Winchester has clear sky and is
currently 19 degrees.”

Now if you know ANYTHING about the UK, weather like that would be a miracle!!

So when I then ask “Andromeda, what is the weather in Winchester?” I get:

" >> With a high of 21 and a low of 16,
winchester has broken clouds and is
currently 17 degrees."
Which is more like it!!!

I suspect that the first ( and default) weather is the condition in Winchester, in the U.S. as opposed to the REAL ( and original!) Winchester in England.

Note that I had not seen this behavior with the Linux VM version of Mycroft, but I have not fired it up for a while!

Thanks for reporting this @a_user.

We have an open bug on home.mycroft.ai which is related to this - I’ve posted the wording of the bug below as it’s in a private repo.


Credits: this bug was identified, replicated and confirmed by user @sfd in Chat with @kathyreid

Description of bug in object-deviation format

When a User uses the select dropdown geosuggest to find a city, and then select one, the value that is stored in home.mycroft.ai is the first option, regardless of which option is selected.

Example:

User selects ‘Hamilton, New Zealand’

Validate by saving, then Speaking to Mark 1 Hey Mycroft, update config, to pull down the web_config_cache.json file.

Inspect the file, and you will see that the first option from the select has been stored:

pi@mark_1:/opt/mycroft $ cat web_config_cache.json 
{"date_format": "DMY", "tts": {"google": {"created_at": 1504481866992, "updated_at": 1514794901075}, "module": "mimic", "fatts": {"created_at": 1504481866991, "updated_at": 1514794900939}, "mimic": {"created_at": 1504481866989, "voice": "ap", "updated_at": 1514794900809}, "espeak": {"created_at": 1504481866987, "updated_at": 1514794900679}, "marytts": {"created_at": 1504481866986, "updated_at": 1514794900548}}, "opt_in": true, "created_at": 1504481866955, "updated_at": 1514794898083, "listener": {"energy_ratio": 1.5, "created_at": 1504481866996, "updated_at": 1514794901398, "channels": 1, "sample_rate": 16000, "multiplier": 1.0, "threshold": 1e-90, "phonemes": "HH EY . M AY K R AO F T", "wake_word": "hey mycroft"}, "time_format": "full", "skills": {"directory": "~/.mycroft/skills", "created_at": 1504481866994, "updated_at": 1514794901226, "stop_threshold": 2.0}, "stt": {"google": {"credential": {"created_at": 1504481866970, "updated_at": 1514794899383}, "created_at": 1504481866970, "updated_at": 1514794898989}, "ibm": {"credential": {"created_at": 1504481866958, "updated_at": 1514794898334}, "created_at": 1504481866958, "updated_at": 1514794898218}, "mycroft": {"credential": {"created_at": 1504481866965, "updated_at": 1514794898856}, "created_at": 1504481866965, "updated_at": 1514794898469}, "module": "mycroft", "wit": {"credential": {"created_at": 1504481866981, "updated_at": 1514794900417}, "created_at": 1504481866981, "updated_at": 1514794900031}, "openstt": {"credential": {"created_at": 1504481866976, "updated_at": 1514794899900}, "created_at": 1504481866976, "updated_at": 1514794899521}}, "location": {"coordinate": {"latitude": 43.255721, "created_at": 1487035821068, "updated_at": 1487035821068, "longitude": -79.871102}, "city": {"created_at": 1487035820977, "state": {"country": {"created_at": 1486117561146, "code": "CA", "name": "Canada", "updated_at": 1486117561146}, "created_at": 1486117561095, "code": "ON", "name": "Ontario", "updated_at": 1486117561095}, "code": "Hamilton", "name": "Hamilton", "updated_at": 1487035820977}, "created_at": 1487035820972, "updated_at": 1487035820972, "timezone": {"code": "America/Toronto", "name": "Eastern Standard Time", "dst_offset": 3600000, "created_at": 1486117561337, "updated_at": 1486117561337, "offset": -18000000}}, "enclosure": {"created_at": 1504481866997, "rate": 9600, "updated_at": 1514794901541, "timeout": 5.0, "port": "/dev/ttyAMA0"}, "system_unit": "metric"}

Steps to replicate

  1. Go to home.mycroft.ai, Devices
  2. Change the Location to a city that is a duplicate - ie there are more than one of them in the world
  3. Select an option that is not the first option presented in the select. Take note of what the first option is.
  4. Save
  5. Update config on Mycroft device
  6. Inspect web_config_cache.json file, will show the first option in Step #2

END STEPS

Bug has been validated with the following cities

  • Edinburgh
  • Perth
  • Hamilton

What I think has happened here is that you’ve hit this bug with one of your Devices. What happens if you try to change the location to a nearby town or location?

Kind regards,
Kathy

Hi Kathy. do you ever sleep? :slight_smile:
I changed it to a nearby town ( Andover, UK) and it has teh same problem it seems to give the weather of Andover in MAS rather than Andover UK, unless I specifically ask for andoer’s whether ( not stating the country, as per my example)
So it really does seem to be taking the first “Andover” from the list, rather that the one selected :slight_smile:

I occasionally go into low power mode :wink:

Thanks so much for doing some diagnostics there. I suspect this is the cause of the issue, so what I’d recommend is setting the location to something in the same timezone or nearby which has a distinct or unique name, just as a workaround.

Heads up to my colleague @matheus-mycroft that this location bug appears to be occurring again; I will dig into it over the next couple of days.

Kind regards, K.

OK No worries
My Picroft seems to have stopped working properly after 2 days of playing anyway :frowning:
II am about to save an image of the SD card and then put the base image back on to start again.

@KathyReid,
Just an FYI, I have an issue where I ask Mycroft “how far is…” and then provide a neighboring city name and it tells me 1500 kms away. This is definitely not correct as it is less than 10kms. My thoughts are it is giving me the distance to Lawrence, Kansas. But I have not dug into it. I had planned on providing some more specific details but since we are on the topic of location issues I thought I would bring it up.

Thanks for reporting this, @a_user and @pcwii. I did a bit more digging on this one, and am CC’ing my colleague @matheus-mycroft as we’ve had some internal discussions about this one - thanks for your advice and help Matheus!

What I think is happening is that the location is being saved incorrectly to home.mycroft.ai.

My reasoning for this is:

Check that my location is correct in /var/temp/mycroft_web_config_cache.json

This is the contents of my /var/temp/mycroft_web_config_cache.json. It shows that the location I entered for the Device on home.mycroft.ai as ‘Geelong, VIC’ has defaulted to ‘Saint Albans Park’, which is a suburb about 1.5km / 1 mile away - which is pretty close.

However, the latitude and longitude information is incorrect.

The approximate lat and long for St Albans Park is:
-38.190113, 144.390420

The reported lat and long for my Device is;
49.398752, 8.672434

so it’s quite different - and I can’t explain the anomaly - it’s not a straightforward transverse, or flipping the lat and long.

{
  "location": {
    "city": {
      "created_at": 1513245856347,
      "name": "Saint Albans Park",
      "updated_at": 1513245856347,
      "code": "St Albans Park",
      "state": {
        "created_at": 1489950675941,
        "name": "Victoria",
        "updated_at": 1489950675941,
        "code": "VIC",
        "country": {
          "created_at": 1486125571309,
          "name": "Australia",
          "updated_at": 1486125571309,
          "code": "AU"
        }
      }
    },
    "coordinate": {
      "created_at": 1506792427668,
      "latitude": 49.398752,
      "updated_at": 1506792427668,
      "longitude": 8.672434
    },
    "created_at": 1513245856346,
    "updated_at": 1513245856346,
    "timezone": {
      "updated_at": 1489950676105,
      "dst_offset": 3600000,
      "code": "Australia/Melbourne",
      "offset": 36000000,
      "name": "Australian Eastern Standard
      Time(Victoria)
      ", "
      created_at ": 1489950676105}}, "
      time_format ": "
      full ",
      "updated_at": 1527173316815,
      "stt": {
        "wit": {
          "created_at": 1504481866981,
          "updated_at": 1527173316836
        },
        "openstt": {
          "created_at": 1504481866976,
          "updated_at": 1527173316833
        },
        "ibm": {
          "created_at": 1504481866958,
          "updated_at": 1527173316818
        },
        "google": {
          "created_at": 1504481866970,
          "updated_at": 1527173316829
        },
        "mycroft": {
          "created_at": 1504481866965,
          "updated_at": 1527173316823
        },
        "module": "mycroft"
      },
      "created_at": 1504481866955,
      "enclosure": {
        "timeout": 5.0,
        "port": "/dev/ttyAMA0",
        "updated_at": 1527173317076,
        "rate": 9600,
        "created_at": 1504481866997
      },
      "tts": {
        "fatts": {
          "created_at": 1504481866991,
          "updated_at": 1527173316844
        },
        "google": {
          "created_at": 1504481866992,
          "updated_at": 1527173316846
        },
        "module": "mimic",
        "marytts": {
          "created_at": 1504481866986,
          "updated_at": 1527173316839
        },
        "mimic": {
          "created_at": 1504481866989,
          "voice": "ap",
          "updated_at": 1527173316843
        },
        "espeak": {
          "created_at": 1504481866987,
          "updated_at": 1527173316841
        }
      },
      "skills": {
        "created_at": 1504481866994,
        "stop_threshold": 2.0,
        "updated_at": 1527173317072,
        "directory": "~/.mycroft/skills"
      },
      "date_format": "DMY",
      "system_unit": "metric",
      "listener": {
        "sample_rate": 16000,
        "updated_at": 1527173317074,
        "phonemes": "HH EY . M AY K R AO F T",
        "threshold": 1e-90,
        "multiplier": 1.0,
        "wake_word": "hey mycroft",
        "channels": 1,
        "created_at": 1504481866996,
        "energy_ratio": 1.5
      },
      "opt_in": true
    }}

Weather Skill output

However, if we look at the Weather Skill output;

pi@mark_1:/var/log $ tail -f mycroft-skills.log | grep -i weather
12:10:28.260 - mycroft.skills.settings:_request_my_settings:440 - DEBUG - getting skill settings from server for WeatherSkill
12:10:29.260 - SKILLS - DEBUG - {"type": "recognizer_loop:utterance", "context": {"client_name": "mycroft_listener", "ident": "1529496626.0428698-511190078"}, "data": {"session": "6c138788-d053-4dc7-a759-85494625c48d", "utterances": ["what's the weather like"], "lang": "en-US"}}
12:10:29.288 - SKILLS - DEBUG - {"context": {"client_name": "mycroft_listener", "ident": "1529496626.0428698-511190078", "target": null}, "type": "skill-weather:CurrentWeatherIntent", "data": {"confidence": 0.5, "utterance": "what's the weather like", "skill_weatherWeather": "weather", "__tags__": [{"from_context": false, "start_token": 2, "end_token": 2, "entities": [{"confidence": 1.0, "key": "weather", "data": [["weather", "skill_weatherWeather"]], "match": "weather"}], "key": "weather", "match": "weather"}], "intent_type": "skill-weather:CurrentWeatherIntent", "target": null}}
12:10:29.305 - SKILLS - DEBUG - {"context": {"client_name": "mycroft_listener", "ident": "1529496626.0428698-511190078", "target": null}, "type": "mycroft.skill.handler.start", "data": {"name": "WeatherSkill.handle_current_weather"}}
12:10:31.070 - requests.packages.urllib3.connectionpool - DEBUG - https://api.mycroft.ai:443 "GET /v1/owm/weather?lon=8.672434&lat=49.398752&lang=en HTTP/1.1" 200 435
12:10:33.019 - SKILLS - DEBUG - {"context": null, "type": "enclosure.weather.display", "data": {"temp": "28", "img_code": 0}}
12:10:33.133 - SKILLS - DEBUG - {"type": "Command: weather.display=28,x=2,IICEIBMDNLMDIBCEAA", "context": null, "data": {}}
12:10:43.044 - SKILLS - DEBUG - {"context": {"client_name": "mycroft_listener", "ident": "1529496626.0428698-511190078", "target": null}, "type": "mycroft.skill.handler.complete", "data": {"name": "WeatherSkill.handle_current_weather"}}

we can see that the long and lat co-ordinates passed to the Weather Skill are correct;

GET /v1/owm/weather?lon=8.672434&lat=49.398752&lang=en HTTP/1.1" 200 435

The lat and long above correlate to, guess what, somewhere in coastal Somalia, which explains the temperature anomalies that I’ve been getting (ie 30 C when it was 12 C in Geelong today).

The question is why the anomaly?

My guess is that there is that we have a bug when the latitude and longitude are calculated from the location when the user changes the Device’s location in home.mycroft.ai.

Location output

Just to check this, I got the location GET response from home.mycroft.ai;

{
  "uuid": "25f4bcc9-5bb6-4d00-a845-7a356b1b7f6b",
  "createdAt": 1513245856346,
  "updatedAt": 1513245856346,
  "coordinate": {
    "uuid": "923dcda3-59bc-4672-9071-26cdd89a5788",
    "createdAt": 1506792427668,
    "updatedAt": 1506792427668,
    "latitude": 49.398752,
    "longitude": 8.672434
  },
  "timezone": {
    "uuid": "4f0c4aac-8cc6-45f9-b08c-e5cf5730408a",
    "createdAt": 1489950676105,
    "updatedAt": 1489950676105,
    "code": "Australia/Melbourne",
    "name": "Australian Eastern Standard Time (Victoria)",
    "offset": 36000000,
    "dstOffset": 3600000
  },
  "city": {
    "uuid": "36ad2141-4aa0-4905-b533-1484a107b9e4",
    "createdAt": 1513245856347,
    "updatedAt": 1513245856347,
    "code": "St Albans Park",
    "name": "Saint Albans Park",
    "state": {
      "uuid": "09739301-d6aa-45c5-bccc-dd69b3fc5e0f",
      "createdAt": 1489950675941,
      "updatedAt": 1489950675941,
      "code": "VIC",
      "name": "Victoria",
      "country": {
        "uuid": "407d0752-da4f-4994-a31b-21c16a3c407c",
        "createdAt": 1486125571309,
        "updatedAt": 1486125571309,
        "code": "AU",
        "name": "Australia"
      }
    }
  }
}

TL;DR the lat and long are stored incorrectly on home.mycroft.ai, and are passed correctly to Weather Skill. Weather Skill is doing it’s job correctly. It’s getting incorrect lat/long from home.mycroft.ai.

Decimal vs. Degrees? maybe a conversion error there somewhere?

You know in mapping programs, when someone does it “wrong” things end up “off the coast of Africa”…
That is because 0.00/0.00 is there, of course, but I find it amusing the Geelong has ended up “off the coast of Africa” for you, but of course the wrong side of it :slight_smile:

Appealling though the warm weather would be right now as I sit here defrosting, I’ll pass on Somalia :wink:

Good thinking re the decimals vs degrees. I also wondered whether it was a positive / negative thing as well, but none of those showed a pattern.

Don’t suppose I could ask you what your lat and long are showing?

Best, K.

I would , but I don’t have a var/temp/mycroft_web_config_cache.json ( no /var/temp directory at all!)
( I am supposed to be working too! )

No worries, try /var/tmp/mycroft_web_config_cache.json - fat fingers here.
And no worries, no hurry.

So The lat/long co-ordinates that I have in my json file puts me smack bang in the middle of Heidelberg in Germany, LOL! (remember that this is a newly installed “clean” image of Picroft)
Just a

location
city
created_at 1490132691053
code “Winchester”
name “Winchester”
updated_at 1490132691053
state
created_at 1486129437940
code “England”
name “England”
updated_at 1486129437940
country
code “GB”
name “United Kingdom”
updated_at 1486088331527
created_at 1486088331527
coordinate
longitude 8.672434
latitude 49.398752

Looks the same as yours! If I invert mine I get Somalia, but yours are Heidelberg - I must have mixed up my lat and long and made it long/lat instead. Our co-ordinates are the same!!!

cool!! I will buy you a drink, as soon as I find you… you must be around here _somewhere _ :slight_smile:

Ha! It’s too cold here for a drink other than a hot cup of delicious coffee at the moment :wink: It’s certainly not Somalia weather!!

OK, my colleague @matheus-mycroft has worked some $MAGIC in the backend, however we think the fix might be that you need to reboot your Device, @a_user. If you reboot does your Weather come good?

Best, Kathy

Well, that $MAGIC has fixed the weather ( if only it could make BETTER weather! )
BUT now I have rebooted and my PS3 Mic has stopped working again … Still a CLEAN PiCroft build with only coin-toss skill as an extra skill installed :frowning:

Nope nothing will bring the mic back again :frowning:
(Edit) So - shutting down the Pi, then plugging the PS3 mic into a FRESH port on the Windows10PC that then forced it to “install drivers” , unplugging it again and then putting it back into the Pi, and firing it up again brough the mic back to like ( that is the same sequence that woke it up last time too, but I ALSO re-imaged the SD card as well)
Mate… this is driving me slowly crazy! :confounded:

Totally understand your frustration with the Pi3 microphone. Are you OK if I mark this thread as solved, and we can start another thread to work through the Raspberry Pi issues?

Yep :slight_smile:
plus the rest of the characters that i need to make a post