Giter Site home page Giter Site logo

home-assistant-niu-component's People

Contributors

dathosim avatar javirnof avatar marcelwestrahome avatar pikka97 avatar robbinonline avatar syssi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

home-assistant-niu-component's Issues

Country Setting

What format does the Country setting take in the sensor setup?

Telephone Country code eg +49
International Country code eg DE
Global Country name eg Germany
or
Local Country name eg Deutschland

??

I can't get it to connect but narrowing down the correct format will at least put me one step closer.

KeyError: 'distance'

I configured the integration as to the README but unfortunately I get the following error

File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 281, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/niu/sensor.py", line 392, in setup_platform
    NiuSensor(
  File "/config/custom_components/niu/sensor.py", line 499, in __init__
    self._state = self._data_bridge.dataDist(self._id_name)
  File "/config/custom_components/niu/sensor.py", line 425, in dataDist
    return self._dataMoto["data"]["lastTrack"][id_field]
KeyError: 'distance'

Configuration in configuration.yml

- platform: niu
    username: *****
    password: *****
    country: 49
    scooter_id: 0
    monitored_variables:
      - BatteryCharge          # Battery
      - Isconnected            # Battery
      - TimesCharged           # Battery
      - temperatureDesc        # Battery
      - Temperature            # Battery
      - BatteryGrade           # Battery
      - CurrentSpeed           # Moto
      - ScooterConnected       # Moto (has attributes lon. lat. for plotting on a map)
      - IsCharging             # Moto
      - IsLocked               # Moto
      - TimeLeft               # Moto
      - EstimatedMileage       # Moto
      - centreCtrlBatt         # Moto
      - HDOP                   # Moto
      - Longitude              # Moto
      - Latitude               # Moto
      - totalMileage           # OverAll
      - DaysInUse              # OverAll
      - Distance               # Distance
      - RidingTime             # Distance
      - LastTrackStartTime     # LastTrack
      - LastTrackEndTime       # LastTrack
      - LastTrackDistance      # LastTrack
      - LastTrackAverageSpeed  # LastTrack
      - LastTrackRidingtime    # LastTrack
      - LastTrackThumb         # LastTrack

NIU NQi Sport FW TRA01E19

Several entities still not populating after issue #46 was fixed

Some of my entities now have correct data after issue #46 was solved, however not all of them do.

The following entities continue to show 'unknown' or have meaningless data:

  • 1. All of the 'last track' entities show as 'unknown', and the map does not work
  • 2. Battery Charge shows as unknown, even after turning on the scooter and connecting with bluetooth to the app
  • 3. Battery Grade shows as 0%. Not sure what I should be seeing there.
  • 4. Centrctrlbat shows as 0%. Not sure what I should be seeing there.
  • 5. HDOP (not sure what that is actually) shows as 0
  • 6. Latitude and longitude show as 0
  • 7. Temperature shows as 0 degrees C. That can't be right.
  • 8. TemperatureDesc (not sure what that is) shows as 'overcooled'. That doesn't seem right either
  • 9. Time Left shows as 0h. However the battery is fully charged.
  • 10. Times charged shows as unknown. The app shows the correct value
  • 11. Some entities show '0' but I suspect it's not an issue as I would expect them to show '0' at this time, such as 'current speed'. I'll need to go for a ride to determine if that updates correctly

So it appears certain entities are still not getting data from the server correctly.

dataTrack - TypeError: 'bool' object is not subscriptable

Hi. I've installed the component and configured it. I receive this error when it inits:

2022-08-01 13:38:35 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up niu platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/niu/sensor.py", line 392, in setup_platform
    NiuSensor(
  File "/config/custom_components/niu/sensor.py", line 503, in __init__
    self._state = self._data_bridge.dataTrack(self._id_name)
  File "/config/custom_components/niu/sensor.py", line 436, in dataTrack
    (self._dataTrackInfo["data"][0][id_field]) / 1000
TypeError: 'bool' object is not subscriptable

component doesn't work when updated to home assistant os 8.5

Platform error sensor.niu - Exception importing custom_components.niu.sensor

Unexpected exception importing platform custom_components.niu.sensorTraceback (most recent call last): File "/usr/src/homeassistant/homeassistant/loader.py", line 657, in get_platform cache[full_name] = self._import_platform(platform_name) File "/usr/src/homeassistant/homeassistant/loader.py", line 674, in _import_platform return importlib.import_module(f"{self.pkg_path}.{platform_name}") File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1050, in _gcd_import File "", line 1027, in _find_and_load File "", line 1006, in _find_and_load_unlocked File "", line 688, in _load_unlocked File "", line 879, in exec_module File "", line 1017, in get_code File "", line 947, in source_to_code File "", line 241, in _call_with_frames_removed File "/config/custom_components/niu/sensor.py", line 564 self._state = self._data_bridge.dataBat(self._id_name) IndentationError: unexpected indent

It looks awesome but I couldn't install it.

Awesome work, but hasnt able to make it work. I created a python_scripts folder inside the config root folder, inside I have placed the sensor.py and I added the yaml to the configuration.yaml, but it shows as invalid niu component is not a component. if you can write install instructions it would help a lot, I was able to get my token already dont know if that helps. Thank you, keep the great work!

Known bug is solved by new firmware (v3,TRA01E18)

I saw your comment on my pull request for the niu integration in home assistant and looked into this repo. The known bug that's causing the updates to stop is fixed by Niu in the scooters firmware v3,TRA01E18. This update has to be manually installed at a authorized dealer (so no automagical OTA install). I have this version on my scooter for a while and it's stable for me 👍

Timeout after 30 seconds when not being able to fetch data from NIU

I have tested your component for NIU scooter integration and it seems to work OK, but lately I am experiencing problems with my HA instance that perhaps is due to communication locking up occasionally.
I have this example in my log:

Logginformation (WARNING)
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:545
Integration: Sensor (documentation, issues)
First occurred: 21:06:15 (3 occurrences)
Last logged: 21:08:18

Updating niu sensor took longer than the scheduled update interval 0:00:30

Does this mean that the fetching of information does not time out until 30 seconds has passed? Couldn't this potentially lock up the frontend/backend of Home Assistant?

Also I am not aware of how often the values are polled from NIU, perhaps introducing a configuration option for poll interval would be possible to implement?

downloding i

it says Unsupported url if you add it to Blueprints

Only Last Track sensor available

Hello,

I tried this integration with an account which has a Niu NQI linked.
Unfortunately there is only the Last Track Camera sensor available.

Any idea how to get the other sensors available?
Screenshot 2023_10_28 18-50-34@2x

Integration not found

Dear.
Since HA version 2021.6.0 the component doesen't work anymore.
I get this message:
Platform error sensor.niu - Integration 'niu' not found.

I've tried to reinstall it but nothing.
This situation stops HA from restarting or updating.

Thanks
Andrea

Please add a license

I would be happy if you add a license to the code / repository. An Apache 2.0 license would be cool!

No new sensors

I have installed this component added the config as described.
I only see this in my log and no new sensors: 2020-07-14 13:02:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for niu which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.

Add new oauth2 endpoint support

Hi, Thank you very much to supply this component.

Could you consider to support +86 (China) Country Code ?

Here is the log:

2021-11-28 22:59:57 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up niu platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/niu/sensor.py", line 374, in setup_platform
token = get_token(username, password, country)
File "/config/custom_components/niu/sensor.py", line 287, in get_token
return data["data"]["token"]
KeyError: 'token'

data never refresh

Hello, I have installed this extension (v 2.1.3) using HACS.

It detected my scooter but it only refresh data when I reboot home assistant.

uppercase and whitespaces

Hi,
first of all - thank you for providing this component!!
As I was trying to activate this component, I found an issue that should be easily resolvable :)

If the Name of the scooter contains whitespaces or includes capital letters, you get the error below. So if you would implement x.lower and maybe replace whitespaces, this should be it.

Log:
2020-08-23 21:06:30 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up niu platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 192, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 301, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 443, in _async_add_entity
raise HomeAssistantError(f"Invalid entity id: {entity.entity_id}")
homeassistant.exceptions.HomeAssistantError: Invalid entity id: sensor.niu_scooter_NAME_battery_charge

Thanks!

no location

The NIU scooter is no longer showing on the map. The scooterconnected no longer has lat&long attributes. Any ideas on how ti fix this?

Battery Status never updates

I tried changing the password several times but it will be stuck at 88% battery nomatter what the real value is

Integration hangs until HA restart

I bought my Niu MC in August last year, and am very happy with the HA integration! However, my experience is that the integration stops receiving/updating data after a while, and the only fix is to restart the entire HA instance. Reloading the the integration is not successful. Is this familiar, and/or is there a fix?

Expose binary sensor entities for booleans

Please change the device Class of the following sensor values to the right class.
I'm not a python developer so I can understand the code but can't change it. But I hope I found the right code lines.

  1. sensor.niu_scooter_$NAME_isconnected
    Type: binary Sensor
    device_class: connectivity
  2. sensor.niu_scooter_$NAME_ischarging
    Type: binary Sensor
    device_class: battery_charging
  3. sensor.niu_scooter_$NAME_islocked
    Type: binary Sensor
    device_class: lock
    "IsLocked": ["is_locked", "", "lockStatus", SENSOR_TYPE_MOTO, "lock", "mdi:lock"],

Thanks

Installation not working

Having trouble installing this component - have downloaded via HACS and also tried manually copying custom_components folder. Both have no entities showing after entering the sensor code into configuration.yaml and altering login details. Email and password definitely correct and code set to 44 (uk). Scooter_id is 0.

There is an integration which appears in devices & services > add integration called “Nui Scooters” [sic] but on attempting to add the integration it says “ This device cannot be added from the UI, You can add this device by adding it to your 'configuration.yaml'. See the documentation for more information.“

I’m a little unsure what to try next. Can anyone help?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.