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

Add possiblity to (re)name Battery Service for individual devices #41

Open
hashat opened this issue Nov 4, 2024 · 0 comments
Open

Add possiblity to (re)name Battery Service for individual devices #41

hashat opened this issue Nov 4, 2024 · 0 comments
Labels
enhancement New feature or request to-implement

Comments

@hashat
Copy link

hashat commented Nov 4, 2024

Hi Ryler,

Firstly, thank you for the complete revamp/rework of this plugin, awesome work!

I have two or three ideas I'd like to discuss with you if I get them correctly how they work as of now, and also offering my contribution if you think my suggestions would fly. Most of them are related, it's kind of hard to structure them but I'll try to and I'll open three issues. First:

It's a great thing that now we can see the "low battery" status of individual devices. Here's an excerpt of my WH31 report:

Form item: "temp1f" = "43.70"
Form item: "humidity1" = "65"
Form item: "temp2f" = "70.52"
Form item: "humidity2" = "48"
Form item: "temp3f" = "72.68"
Form item: "humidity3" = "55"
Form item: "temp4f" = "71.24"
Form item: "humidity4" = "59"
Form item: "temp5f" = "71.78"
Form item: "humidity5" = "58"
Form item: "temp6f" = "71.78"
Form item: "humidity6" = "59"
Form item: "temp7f" = "67.64"
Form item: "humidity7" = "56"
Form item: "temp8f" = "57.74"
Form item: "humidity8" = "44"
Form item: "batt1" = "0"
Form item: "batt2" = "0"
Form item: "batt3" = "0"
Form item: "batt4" = "0"
Form item: "batt5" = "0"
Form item: "batt6" = "0"
Form item: "batt7" = "0"
Form item: "batt8" = "1"

This shows, that my #8 unit has low battery. Consequently in the Home app (and other apps reading the Home data) there's an exclamation that it has low battery, which is great. I love this.
However, I don't necessarily want this property to show separately. Currently, both in the Homebridge interface, it brings up the battery status as a separate Accessory, as "Battery Service", "Status Low Battery: 1", and also in more sophisticated apps like Home+ these will be displayed as separate sensors or properties. In the case of WH31, I have three items for each device: A Temperature sensor, a Humidity Sensor, and the Battery Service.

It is possible to rename the Temperature and Humidity sensors separately, like this

"nameOverrides": [
{ "key": "WN31CH2:temperature", "value": "Living room" },
{ "key": "WN31CH2:humidity", "value": "Living room" },
...

and it would be great if I could similarly rename the Battery service the same way, for each device.

I guess in the constructor of WN31 it would be possible to add a third section to do just this, similarly to how temperature and humidity properties are (re)named:

if (!utils.includesAny(hidden, ['temperature', `${this.shortServiceId}:temperature`])) {
  const temperatureName = utils.lookup(this.platform.config?.nameOverrides, `${this.shortServiceId}:temperature`);
  this.temperature = new TemperatureSensor(platform, accessory, `${this.accessoryId}:temperature`, temperatureName || 'Temperature');
} else {
  this.temperature = new TemperatureSensor(platform, accessory, `${this.accessoryId}:temperature`, 'Temperature');
  this.temperature.removeService();
  this.temperature = undefined;
}

Do you agree?
In standard Home app this doesn't change much, but for more advanced users it would (at least aesthetically) help cluster the dozens of sensors we have (currently it just shows as "WN31 Thermo Hygro Sensor", and is unchangeable).

Is this doable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request to-implement
Projects
None yet
Development

No branches or pull requests

2 participants