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

Fix for showing 50% battery instead of 100% #6940

Merged
merged 2 commits into from
Jan 21, 2024
Merged

Fix for showing 50% battery instead of 100% #6940

merged 2 commits into from
Jan 21, 2024

Conversation

newlund
Copy link
Contributor

@newlund newlund commented Jan 21, 2024

Onesti (nimly) does not seem to comply to the ZCL and report a batteryPercentageRemaining of 100 when the battery is full (should be 200).

Onesti does not seem to comply to the ZCL and report a batteryPercentageRemaining of 100 when the battery is full (should be 200).
@Koenkk Koenkk merged commit ec956f7 into Koenkk:master Jan 21, 2024
2 checks passed
@Koenkk
Copy link
Owner

Koenkk commented Jan 21, 2024

Thanks!

@msandvold
Copy link

@newlund - Do You know how to fix this?
Koenkk/zigbee2mqtt#21182

@newlund
Copy link
Contributor Author

newlund commented Mar 14, 2024

@newlund - Do You know how to fix this? Koenkk/zigbee2mqtt#21182

Which lock do you have?
zigbeeModel: ['easyCodeTouch_v1', 'EasyCodeTouch', 'EasyFingerTouch', 'NimlyPRO', 'NimlyCode', 'NimlyTouch', 'NimlyIn']

I have the NimlyPRO and it shows 0-100% after this fix. Previously it showed 0-50%
If you don't have a Nimly lock, perhaps those locks needs to be defined separately here:
https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/src/devices/onesti.ts

@msandvold
Copy link

msandvold commented Mar 14, 2024

Hi, @newlund
I have mouted the "EasyFingerTouch"
But i shows as a "easyCodeTouch_v1"

Device type: EndDevice
Zigbee Model: easyCodeTouch_v1
Zigbee Manufacturer: Onesti Products AS
Description: Zigbee module for EasyAccess code touch series

As mentioned, the battery wnt from 100% to 200% after update og z2m:
in all these versions -> 1.35.2-1 / 1.35.3-1 / 1.36.0-1
When rollback to -> 1.35.1-1 it shows 100%

@msandvold
Copy link

msandvold commented Mar 14, 2024

@newlund
could this "js" file work. I do not get any errors, but battery state still, eq 200%

const` fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const ota = require('zigbee-herdsman-converters/lib/ota');
const constants = require('zigbee-herdsman-converters/lib/constants');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;


module.exports = [
    {
        zigbeeModel: ['easyCodeTouch_v1'],
        model: 'easyCodeTouch_v1',
        vendor: 'Onesti Products AS',
        description: 'Zigbee module for EasyAccess code touch series',
        fromZigbee: [fz.lock, fz.lock_operation_event, fz.battery, fz.lock_programming_event,
            fz.easycodetouch_action],
        toZigbee: [tz.lock, tz.easycode_auto_relock, tz.lock_sound_volume, tz.pincode_lock],
        meta: {pinCodeCount: 1000, battery: {dontDividePercentage: false}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(11);
            await reporting.bind(endpoint, coordinatorEndpoint, ['closuresDoorLock', 'genPowerCfg']);
            await reporting.lockState(endpoint);
            await reporting.batteryPercentageRemaining(endpoint);
            await endpoint.read('closuresDoorLock', ['lockState', 'soundVolume']);
            device.powerSource = 'Battery';
            device.save();
        },
        exposes: [e.lock(), e.battery(), e.sound_volume(),
            e.enum('last_unlock_source', ea.STATE, ['zigbee', 'keypad', 'fingerprintsensor', 'rfid',
                'self', 'unknown']).withDescription('Last unlock source'),
            e.text('last_unlock_user', ea.STATE).withDescription('Last unlock user').withDescription('Last unlock user'),
            e.enum('last_lock_source', ea.STATE, ['zigbee', 'keypad', 'fingerprintsensor', 'rfid',
                'self', 'unknown']).withDescription('Last lock source'),
            e.text('last_lock_user', ea.STATE).withDescription('Last lock user'),
            e.text('last_used_pin_code', ea.STATE).withDescription('Last used pin code'),
            e.binary('auto_relock', ea.STATE_SET, true, false).withDescription('Auto relock after 7 seconds.'),
            e.pincode(),
    },
`];

@newlund
Copy link
Contributor Author

newlund commented Mar 19, 2024

I have submitted a PR:
#7237

It will hopefully revert the last change for easy*-locks and still show correct battery percentage for Nimly locks.

Should solve this:
Koenkk/zigbee2mqtt#21182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants