home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.42k stars 30.66k forks source link

Unable to create mvglive sensors #121866

Open dorancemc opened 3 months ago

dorancemc commented 3 months ago

The problem

I am configuring a sensor for a station, according to the documentation I validated that the station exists but it still generates an error.

What version of Home Assistant Core has the issue?

core-2024.7.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

mvglive

Link to integration documentation on our website

https://www.home-assistant.io/integrations/mvglive

Diagnostics information

No response

Example YAML snippet

sensor:
  - platform: mvglive
    nextdeparture:
      - station: Dasing

Anything in the logs that might be useful for us?

Registrador: homeassistant
Fuente: components/sensor/__init__.py:655
Ocurrió por primera vez: 7:03:33 p.m. (1 ocurrencias)
Último inicio de sesión: 7:03:33 p.m.

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 648, in state
    numerical_value = int(value)
                      ^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '-'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 651, in state
    numerical_value = float(value)
                      ^^^^^^^^^^^^
ValueError: could not convert string to float: '-'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1048, in _async_update_entity_states
    await entity.async_update_ha_state(True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 962, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1133, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1068, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1013, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 655, in state
    raise ValueError(
ValueError: Sensor sensor.dasing has device class 'None', state class 'None' unit 'min' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: '-' (<class 'str'>)


### Additional information

_No response_
home-assistant[bot] commented 3 months ago

mvglive documentation mvglive source

joshuajeschek commented 2 months ago

Same here, on core-2024.8.2 :)

felixbaumgaertner commented 2 months ago

Same here

Core 2024.8.2 Supervisor 2024.08.0 Operating System 13.1 Frontend 20240809.0

Logger: homeassistant.components.mvglive.sensor Source: components/mvglive/sensor.py:197 integration: MVG (documentation, issues) First occurred: 3:18:34 PM (11 occurrences) Last logged: 3:23:34 PM Returned data not understood

joostlek commented 2 months ago

MVGLive has been disabled because it was using non open source code to operate in 2024.8.0

felixbaumgaertner commented 1 month ago

MVGLive has been disabled because it was using non open source code to operate in 2024.8.0

Will it be enabled in the future? If not, will it be removed from the integration website? I find it misleading that it is visible there but it is not possible to set it up.

joostlek commented 1 month ago

If someone steps up and either get the library licensed correctly or someone who creates a new library and then it can be enabled.

That's a good point, I'll check if we can automate such check

DavidMStraub commented 1 month ago

There are various custom integrations using the current API, would be good to convince the authors to submit a PR to replace the outdated integration, e.g. https://github.com/danielpotthast/mvg @danielpotthast, https://github.com/Nisbo/another_mvg @Nisbo?

Nisbo commented 1 month ago

There are various custom integrations using the current API, would be good to convince the authors to submit a PR to replace the outdated integration, e.g. https://github.com/danielpotthast/mvg @danielpotthast, https://github.com/Nisbo/another_mvg @Nisbo?

Currently I am working on the next release with the GUI configuration. So I recommend to wait till the next version is stable for some time.

danielpotthast commented 1 month ago

There are various custom integrations using the current API, would be good to convince the authors to submit a PR to replace the outdated integration, e.g. https://github.com/danielpotthast/mvg @danielpotthast, https://github.com/Nisbo/another_mvg @Nisbo?

If it’s possible to add it as a new integration without migrating the legacy integration, I’d be willing to give it a try. I recently moved the mvg package into the integration because the current version stopped working for me. Not sure if that’s a deal breaker?

joostlek commented 1 month ago

We have to migrate the legacy configuration, but i can help you with that if needed.

I'm not sure what you mean with the mvg package?

danielpotthast commented 1 month ago

Why do we? The name mvglive is no longer correct because the service no longer exists.

I’m referring to the pip package mvg.

joostlek commented 1 month ago

People still might have it in their configurations, and we promise a 6 month period for configuration to be deprecated, and it's usually a little effort for a big increase in usability

joostlek commented 1 month ago

mvg seems to have a MIT license, so that would be allowed

danielpotthast commented 1 month ago

People still might have it in their configurations, and we promise a 6 month period for configuration to be deprecated, and it's usually a little effort for a big increase in usability

https://github.com/home-assistant/core/issues/81760 – The old service has been broken for at least a year. To be honest, I don’t want to spend time on this migration.

joostlek commented 1 month ago

Oh but I didn't have the full picture apparently, the reason this now got more blocking is because the old library wasn't open source. I did not know the rest was broken.

But I still think we require a migration for the promise we make for the community and like said, I'm happy to help out where needed if that can help you get the core integration working again.

joostlek commented 1 month ago

We add these migrations to finally be more stable, as a lot of people got used to Home Assistant breaking every release, so this is our way of making sure we don't break every release, so if it's technically possible we should maintain our stability

Nisbo commented 1 week ago

I just released the latest version of Another MVG (v2.0.0) yesterday which includes language support and GUI configuration https://github.com/Nisbo/another_mvg Dont know how to integrate this to the Home Assistant Core.