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

expose: allow setting the label for Lock() #2373

Merged
merged 1 commit into from
Mar 17, 2021
Merged

Conversation

sjorge
Copy link
Sponsor Contributor

@sjorge sjorge commented Mar 14, 2021

For devices with multiple locks or for devices that have a lock function, allow setting of a label.
e.g. for TRV's with a keypad_lockout it is now called keypad_lockout instead of state which is confusing if there are multiple switches/locks all called 'state'

lib/exposes.js Outdated Show resolved Hide resolved
@Koenkk
Copy link
Owner

Koenkk commented Mar 14, 2021

I remember now why the name is always state. This allows to determine what feature indicates the state of the lock which breaks when we set the name (https://www.zigbee2mqtt.io/information/exposes#lock)

allow setting of a label.

Where did you plan to use this label?

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 14, 2021

image

Before it was state instead of keypad lockout, having one is fine but the danfoss uses a few binary sensors so you end up with a few list labeled state, which is confusing.

Perhaps keypad_lockout should not be a use Lock() but just Binary() as there is no lock_state for those just one property keypad_lockout that is unlock, lock1(, lock2, lock3, ...) as its a property of the TRV not a seperate Lock device?

Switch() has a similar problem, if a device has a multiple Switch() and Lock() exposes it gets confusing.

I think switching e.keypad_lockout() away from Lock() seems the better solution here?

@Koenkk
Copy link
Owner

Koenkk commented Mar 14, 2021

@nurikk what about using the property as the label in the frontend instead of name?

@nurikk
Copy link
Contributor

nurikk commented Mar 15, 2021

@nurikk what about using the property as the label in the frontend instead of name?

It might be better to add a label property, instead of relying on property key

@nurikk
Copy link
Contributor

nurikk commented Mar 15, 2021

Currently we don't have a clear definition of what is
feature.name
feature.type

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

I think just not using e.Lock() here is the correct way to resolve this... it really isn't a 'Lock' Device but a extra feature on a Climate device. And that should work fine without any changes to the frontend.

@Koenkk
Copy link
Owner

Koenkk commented Mar 16, 2021

@sjorge what if it is exposed as a switch?

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

@sjorge what if it is exposed as a switch?

Same issue

const feature = new Binary('state', access, value_on, value_off).withProperty(property).withDescription(description);

@Koenkk
Copy link
Owner

Koenkk commented Mar 16, 2021

@sjorge what if we use:

keypad_lockout: () => new Binary('keypad_lockout', access.STATE_ALL, 'lock1', 'unlock').withDescription('Enables/disables physical input on the device'),

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

keypad_lockout: () => new Binary('keypad_lockout', access.STATE_ALL, 'lock1', 'unlock').withDescription('Enables/disables physical input on the device'),

That was my suggestion when i wrote

I think just not using e.Lock() here is the correct way to resolve this... it really isn't a 'Lock' Device but a extra feature on a Climate device. And that should work fine without any changes to the frontend.

That would indeed fix it.

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

🤔
image

@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

nvm :) I copied your line but it has an error in it, state.ALL is the right one, resting...

Avoid having 'state' label on Climate devices
@sjorge
Copy link
Sponsor Contributor Author

sjorge commented Mar 16, 2021

Looks good now and /get and /set still work

image

@Koenkk
Copy link
Owner

Koenkk commented Mar 17, 2021

Thanks!

@Koenkk Koenkk merged commit 27e7fa2 into Koenkk:master Mar 17, 2021
@sjorge sjorge deleted the kpl_expose branch March 17, 2021 19:11
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