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

[discussion] Reorder code to handle more easily different types of systems/providers #1

Open
vincentdieltiens opened this issue Oct 18, 2022 · 4 comments
Assignees

Comments

@vincentdieltiens
Copy link

Hi,

I'm currently developping a custom component for home assistant that handles some of the Eltako's products , which are based on EnOcean.
More especially :

  • F4SR14 : non-dimmable light
  • FUD14 : dimmable light
  • FSB14 : cover

Because the F4SR14 is not dimmable, the message waited by the actuator is not the same and does not work with the enocean component.

My component is mostly based on this repo and the way I handled it is by creating classes for each type of light ( --> is class inheritance ) :

F4SR14Entity --> EltakoLightEntity --> EltakoEntity, LightEntity
FUD14Entity --> EltakoLightEntity --> EltakoEntity, LightEntity
# the following is not done yet
FSB14Entity --> EltakoCoverEntity --> EltakoEntity, CoverEntity

F4SR14Entity and FUD14Entity set the properties correctly (ColorMode.ONOFF, ColorMode.BRIGHTNESS, ...) and implement the turn_off, turn_on and value_changed methods.
Based on a device_class option in the config, the right class is used.

Implementing all of this in another component is not the best solution :

  • I can't use any of other EnOcean devices because of multiples uses of dongle
  • A certain part of the component is the same as EnOcean

My tought :

Can't we add a "device_class" config for each device type (light, cover, ...) so that we can specify which class to use ?
Adding more systems or devices to the code will be easier : simply add new classes.

What do you think ?

Vincent

@RomeHein
Copy link
Owner

RomeHein commented Jan 9, 2023

Hi @vincentdieltiens !
Sorry for the very late answer, somehow github does not notify me, very annoying :/
Yep, looks like a good idea. So at the end it would look like the sensor.py file right ?
That reminds me I need to update the readme as this library contains the teach in logic now.

@RomeHein RomeHein self-assigned this Jan 9, 2023
@HotteX
Copy link

HotteX commented Jan 24, 2023

Hi! There is another new enocean implementation via mqtt for HA that looks very promising (and works as an addon). Maybe you like to team up, so that we can get the Dolphin rolling on HA? :) https://github.com/mak-gitdev/HA_enoceanmqtt

@RomeHein
Copy link
Owner

RomeHein commented Feb 3, 2023

Hi! There is another new enocean implementation via mqtt for HA that looks very promising (and works as an addon). Maybe you like to team up, so that we can get the Dolphin rolling on HA? :) https://github.com/mak-gitdev/HA_enoceanmqtt

That looks really cool, but I already talked to the owner of the project and I'm not sure that adding a layer of complexity will help.
I would rather rework a new enocean python library and then a cleaner integration in HA. In my sens this is by fare less complex and futur proof. But that's just my opinion 🙌

@RomeHein
Copy link
Owner

RomeHein commented Mar 1, 2023

Hi @dosse2 !
Could you open another issue thread please ? it does not seem related to the original one 😉

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

No branches or pull requests

3 participants