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

New meteo_france sensor not working #18375

Closed
adamotte opened this issue Nov 11, 2018 · 17 comments
Closed

New meteo_france sensor not working #18375

adamotte opened this issue Nov 11, 2018 · 17 comments
Labels
import-deadlock import is not thread-safe in python3 https://github.com/python/cpython/issues/83065 integration: meteo_france to do

Comments

@adamotte
Copy link

Home Assistant release with the issue:
Home Assistant 0.82.0

Operating environment (Hass.io/Docker/Windows/etc.):
Hass.io / DietPi

Component/platform:
New Sensor Meteo France
New merge

Description of problem:
If a postal_code is shared by several cities (it's possible in France, eg : 01700), sensor not work and return error.

Problem-relevant configuration.yaml entries and (fill out even if it seems unimportant):

  - platform: meteo_france
    postal_code: !secret postal_code
    monitored_conditions:
      - temperature
      - weather
      - wind_speed
      - next_rain

Traceback (if applicable):

Error: no forecast for the query `960`

Additional information:
By the way if the weather component could be created to be use with Lovelace Weather Card it will be awesome.

cc @victorcerutti

@victorcerutti
Copy link
Contributor

Thank you for opening this issue.

1. Some postal codes are indeed shared for several cities.
Météo-France returns results using the insee code.
To prevent users the pain to get the insee code, I make a search on their json API to get the needed information for the forecast ;
ex: http://www.meteofrance.com/mf3-rpc-portlet/rest/lieu/facet/previsions/search/01700
Miribel is the second result and the first one is used by default.
In most case, it could be worked around by setting postal_code: Miribel but there is another town named Miribel which is the first result. There is now no simple solution to achieve this, I'm sorry. (or maybe I didn't find the right query to get Miribel 01700 as first result)

This would need a new configuration entry needing insee_code, slug and postal code of the town which is quite annoying. (The search results doesn't return anything with the insee code as the query...)

2. no forecast for the query 960
is your !secret postal_code 960 ?
If so, which city are you expecting the result from ?

3. About the weather card for lovelace
The Météo-France weather component is in progress. It works on my development environment and I hope it will be released on the next version of Home Assistant in 2 weeks

@adamotte
Copy link
Author

Thank you for opening this issue.

You're welcome, you did a great job. I was also thinking about create one for meteo france (like i also have an idea for a "SNCF" components)...

1. Some postal codes are indeed shared for several cities.

We can maybe imagine a simple solution like city_name : 'miribel' (in addition to postal_code) ?

2. no forecast for the query 960

Not at all, mine was exactly postal_code : 01700

3. About the weather card for lovelace

Awesome !

@victorcerutti
Copy link
Contributor

I found out what causes the issue
01700 is not understood as a correct decimal integer but rather an octal which converts to 960 😅

It's easy to fix it with quotes :

- platform: meteo_france
   postal_code: '01700'
   monitored_conditions:
     - temperature
     - weather
     - wind_speed
     - next_rain

I will edit the documentation with a default value using quotes

About the way to select the correct city, this is indeed a solution.
I will update it and hope it will be ready for the next version (0.83)

victorcerutti added a commit to victorcerutti/home-assistant.github.io that referenced this issue Nov 12, 2018
Some postal codes have a leading zero which would be interpreted as an octal int.
Adding quotes on the documentation to be avoid confusion with those postal codes.
Fixes home-assistant/core#18375
@ghost ghost added the to-do label Nov 12, 2018
@fabaff
Copy link
Member

fabaff commented Nov 12, 2018

Docs merged: home-assistant/home-assistant.io@657d1e5

@anthosz
Copy link

anthosz commented Nov 12, 2018

Hello,

First of all, thank you for your component!

Do you know how to use it with another countries? (By example Luxembourg (Luxembourg Ville)).

If I search '06590' (via id in http://www.meteofrance.com/previsions-meteo-monde/luxembourg/06590) -> Théoule sur mer

If I search 'Luxembourg' (http://www.meteofrance.com/mf3-rpc-portlet/rest/lieu/facet/previsions/search/luxembourg), it takes the second value

Best regards,

@adamotte
Copy link
Author

adamotte commented Nov 12, 2018

@victorcerutti The sensor name should stay the same even if the city name is different, no ? (to be aligned with others weathers sensors)
eg : sensor.meteo_france_temperature instead of sensor.paris_temperature

@victorcerutti
Copy link
Contributor

@anthosz It currently only work with cities from France
I will add to the to-do list the possibility to add weather datas from the world

@victorcerutti
Copy link
Contributor

@adamotte I don't know if there is a standard for this.
If you need sensor for multiple locations, then it's convenient to have them named by city.
you could have sensor.paris_temperature along with sensor.lyon_temperature which are easy to read and make automations with
Without naming the city you would have sensor.meteo_france_temperature and sensor.meteo_france_temperature_1

@cdce8p cdce8p closed this as completed in 657d1e5 Nov 15, 2018
@vincegre
Copy link

vincegre commented Jan 1, 2019

3. About the weather card for lovelace
The Météo-France weather component is in progress. It works on my development environment and > I hope it will be released on the next version of Home Assistant in 2 weeks

Some updates ? I was going to post a bug report when realised it was already on the task list ! Thanks ;)

@hatemzidi
Copy link

hatemzidi commented Feb 7, 2019

@victorcerutti
hey, your component just saved my life, +1

i also observed a strange case, in fact, some postal codes can be used for multiple cities/places (like mine : 33160).

can you please add an extra option ( like city_name for example) or may be liste all the available cities as sensors ?

@victorcerutti
Copy link
Contributor

Hi everyone.
Sorry it took so long.
The PR review team was overwhelmed and my update was stuck in limbo.
It's back on track now and I really hope it will be released in the next version.

So, what's coming with this update:

  1. Weather card for Lovelace
  2. Easier configuration (city option will be a query, meaning you can specify a postal code, a city name or both to be sure you get the expected results)
  3. Supports for worldwide cities ex: city: Luxembourg or city: Brest, Bielorussie

Caveats:

This is going to be a breaking change as the configuration will move from a sensor one to a whole meteo_france component.
Be sure to look at the blog post and refer at the new documentation when updating

@vincegre
Copy link

vincegre commented Feb 8, 2019

So, what's coming with this update:

1. Weather card for Lovelace

2. Easier configuration (`city` option will be a query, meaning you can specify a postal code, a city name or both to be sure you get the expected results)

3. Supports for worldwide cities ex: `city: Luxembourg` or `city: Brest, Bielorussie`

Thanks for the great news and work on it, impatient to get that new version to use with my voice assistant 👍

@robbiet480 robbiet480 added to do and removed to-do labels Mar 8, 2019
@victorcerutti
Copy link
Contributor

Just so you know, it's live since wednesday
Hope it fixes all your issues and fulfills your awaited features

@hatemzidi
Copy link

hatemzidi commented Jun 4, 2019

sensor stopped working ... even after multiple restart.

2019-06-04 22:51:25 ERROR (MainThread) [homeassistant.setup] Error during setup of component meteo_france
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/app/homeassistant/components/meteo_france/__init__.py", line 84, in setup
    from meteofrance.client import meteofranceClient, meteofranceError
  File "/usr/local/lib/python3.7/site-packages/meteofrance/__init__.py", line 1, in <module>
    from meteofrance.client import meteofranceClient
  File "/usr/local/lib/python3.7/site-packages/meteofrance/client.py", line 7, in <module>
    import requests
  File "/usr/local/lib/python3.7/site-packages/requests/__init__.py", line 112, in <module>
    from . import utils
  File "/usr/local/lib/python3.7/site-packages/requests/utils.py", line 24, in <module>
    from . import certs
  File "<frozen importlib._bootstrap>", line 980, in _find_and_load
  File "<frozen importlib._bootstrap>", line 149, in __enter__
  File "<frozen importlib._bootstrap>", line 94, in acquire
_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('requests.certs') at 139629248935304

i'm using HA 0.93.2 :(

@anthosz
Copy link

anthosz commented Jun 4, 2019

Hi,

I confirm, I have the same issue but but city outside France works... Only France city are impacted.

Best regards,

@vincegre
Copy link

vincegre commented Jun 8, 2019

Same here, component broken again :( very unstable component...

@bdraco bdraco added the import-deadlock import is not thread-safe in python3 https://github.com/python/cpython/issues/83065 label Apr 10, 2024
@bdraco
Copy link
Member

bdraco commented Apr 10, 2024

cpython issue is python/cpython#83065

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
import-deadlock import is not thread-safe in python3 https://github.com/python/cpython/issues/83065 integration: meteo_france to do
Projects
None yet
Development

No branches or pull requests

9 participants