NIU Custom Component Card

I just got a new Niu NQi Sport and intend to create a custom component & possibly a custom card for Home Assistant. Before I start I’m keen to see how much interest there is in this.

Also, I’ll need a few people to help with testing so that we can check everything works properly and see which devices (hopefully all) it works with.

Post a reply below if you are interested in testing &/or helping develop this, and like the post to give an indication that you are interested in this becoming a reality.

Thanks.

I already made a first version https://github.com/marcelwestrahome/home-assistant-niu-component

1 Like

Great. Due to the lack of interest I just ended up using Node Red. But I’ll take a look at your repo and see if I can help in any way.

it is still working, made an automation to load the battery till 90 % with a shelly wifi switch

@Phill_Healey : i’m interested ! (by this old conversation)
I have a Niu N1S and i tested and contributed to @marcelwestrahome’s component.
I have added last track sensor to know information about the last ride

1 Like

Can you How to install in detail

it is in the HACS repository

Hi @marcelwestrahome ! first of all thanks for starting this project! I just got my new NIU and I tried to use your integration but it keeps giving me this error, can you help me out with is?

(I copy pasted the sensor yaml and changed values according to my moto)

Logger: homeassistant.components.sensor
Source: custom_components/niu/sensor.py:425
Integration: Sensor (documentation, issues)
First occurred: 12:23:11 (1 occurrences)
Last logged: 12:23:11

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 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'

The component works normally, so you have something special. Did you made a typo ?.

Remove the distance form your yaml see what happen.

Hi! yes, it worked I removed a couple of not working. Btw did you manage to display on dashboard the sensor.niu_scooter_moto_lasttrackthumb?

uhh no I tried that also, the entity gets an link, but do not know how to show this.
I am using this component to show the battery and to turn off the loader (with a wifi switch) when the battery is full

Hi Marcel,

Is the Niu Scooter integration still alive? I’m trying to install it but having problems. I’m wondering if it is still working could you help me get it up and running?

I’ve tried installing via HACS and by copying the custom_components folder. I have the necassary platform sensor in configuration.yaml and there are no devices or entities showing up in HA. Any assistance would be much appreciated

Many Thanks

1 Like

My integration stopped working ~2 days ago - what happened?
solved: needed to remove the yaml entries.

1 Like