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

Refactor binary sensors #91

Open
Drealine opened this issue Jan 22, 2024 · 6 comments
Open

Refactor binary sensors #91

Drealine opened this issue Jan 22, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Drealine
Copy link

Hi
It's me again. Did you think it can be more usual to have magnet open detection as binary_sensor and not as sensor in HA ?
Thank you

@petrleocompel petrleocompel self-assigned this Jan 22, 2024
@petrleocompel petrleocompel added the invalid This doesn't seem right label Jan 22, 2024
@petrleocompel
Copy link
Owner

Magnet "presence" is binary_sensor

@petrleocompel
Copy link
Owner

class HikWirelessExtMagnetDetector(CoordinatorEntity, HikDevice, BinarySensorEntity):

class HikMagneticContactDetector(CoordinatorEntity, HikDevice, BinarySensorEntity):

class HikMagnetShockDetector(CoordinatorEntity, HikDevice, BinarySensorEntity):

class HikMagnetOpenDetector(CoordinatorEntity, HikDevice, BinarySensorEntity):

class HikMagnetTiltDetector(CoordinatorEntity, HikDevice, BinarySensorEntity):

All of them are BinarySensorEntity

@Drealine
Copy link
Author

It's strange. All sensors of MagnetShockDetector are sensor.**** and not binary_sensor.***. See bellow :
image

@petrleocompel
Copy link
Owner

I feel like you mixing up dev terminology and ui terminology

@Drealine
Copy link
Author

Drealine commented Jan 22, 2024

Yes you've reason. So the FR is for UI.

@petrleocompel
Copy link
Owner

Okay UI see now what you mean. Refactor will be to change move those from sensor.py to binary_sensor.py and initialize them as binary sensors. Sadly not too easy you can expect such a thing in next release 2.2.0

@petrleocompel petrleocompel changed the title FR - Magnet open as binary_sensor Refactor binary sensors Jan 22, 2024
@petrleocompel petrleocompel added enhancement New feature or request and removed invalid This doesn't seem right labels Jan 22, 2024
@petrleocompel petrleocompel modified the milestones: 2.2.0, 2.3.0 Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants