Barma-lej / halandroid

Worx Landroid package for Home Assistant based on Landroid Cloud by @MTrab
MIT License
112 stars 49 forks source link

Issue with mower name #3

Closed OhSoGood closed 4 years ago

OhSoGood commented 4 years ago

First device added after first installation of HomeAssistant. That has been a tough time!

I first couldn't get any information from sensor and I finally realized that your hardcoded the name you have to your mower, m500 (maybe the default one?) into each and any sensor name in both landroid.yaml and add_to_lovelace.yaml

Thus, if one has a mower called 'mymower', he should replace all 'sensor.landroid_m500' by 'sensor.landroid_mymower'. I guest your package could be improved and that name retrieved by http and not hardcoded.

Barma-lej commented 4 years ago

Here is explanation of this https://github.com/MTrab/landroid_cloud#entities--services

The name of the sensors is set by integration.

OhSoGood commented 4 years ago

Hi, Indeed, that means the mower name is retrieved from the cloud and should not be hardcoded. In landroid_cloud, the corresponding code is info["name"] = util_slugify(f"{DEFAULT_NAME}_{self._client.name}") , so halandroid should do the same, doesn't it?

Barma-lej commented 4 years ago

Yes, my landroid has a name in the app "m500", and therefore the sensors have a names:

sensor.landroid_m500_battery
sensor.landroid_m500_error
sensor.landroid_m500_status
OhSoGood commented 4 years ago

On mine, by default it's WR106SI (it's the same but previous model of the M500, before 2018). There could be also the M1000, the L2000. So to hardcode m500 in landroid.yaml and add_to_lovelace.yaml would make the code incompatible with all these. Do you think you could make your code retrieve dynamically the mower name?

Barma-lej commented 4 years ago

I get data from the sensors that creates Landroid Cloud integration. To change the name of the sensors, you need to change the name of the robot in the application or replace it in package