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 wallswitch support to enocean #86461

Closed
wants to merge 2 commits into from

Conversation

Nivek-domo
Copy link

@Nivek-domo Nivek-domo commented Jan 23, 2023

I propose a modification of the sensor.py file in order to add the recognition of PTM 210 or PTM 535 type sensors from enocean. I just tested on my raspberry pi 3 with the latest official Home assistant image https://community.home-assistant.io/t/enocean-rocker-switch-visible-in-log-but-cant-use-entity/492622

Breaking change

Proposed change

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

I propose a modification of the sensor.py file in order to add the recognition of PTM 210 or PTM 535 type sensors from enocean. I just tested on my raspberry pi 3 with the latest official Home assistant image
https://community.home-assistant.io/t/enocean-rocker-switch-visible-in-log-but-cant-use-entity/492622
@home-assistant
Copy link

Hi Nivek-domo

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

Hey there @bdurrer, mind taking a look at this pull request as it has been labeled with an integration (enocean) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of enocean can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign enocean Removes the current integration label and assignees on the issue, add the integration domain after the command.

@Nivek-domo
Copy link
Author

I propose a modification of the sensor.py file in order to add the recognition of PTM 210 or PTM 535 type sensors from enocean. I just tested on my raspberry pi 3 with the latest official Home assistant image https://community.home-assistant.io/t/enocean-rocker-switch-visible-in-log-but-cant-use-entity/492622

@epenet epenet changed the title Update sensor.py Add wallswitch support to enocean Jan 23, 2023
"""Update the internal state of the sensor."""
action = packet.data[1]

if action == 0xF0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This integration has existing code with protocol details that belong in a 3rd party library. We won't allow changes or additions that add more protocol details to the integration. The details need to be extracted to a 3rd party library published on PyPI first.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the windows handle are integrate like this but not the wall switch??? they are in the same family (rorg f6). I am not the first user how would like to see it in the dashboard.
So i don't understand your answers.
i am new user of HA, so what is Pypi?
i just not understand your answer
Best regards
image
EnOcean_Equipment_Profiles_EEP_V2.6.2_public.pdf

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to explain this above:

This integration has existing code with protocol details that belong in a 3rd party library. We won't allow changes or additions that add more protocol details to the integration.

The existing code is eg the window sensors you mention.

@MartinHjelmare
Copy link
Member

I'll close here now as a different approach is needed. Thanks for your willingness to contribute!

@Nivek-domo
Copy link
Author

Nivek-domo commented Jan 25, 2023

Ah yes my apologies, again sorry I am a noob on HA and in python I had made this code in order to validate and I did not remove the codes for the windows. It was for the test.
I present to you my sincere apologies, I understand better.

so if i write the end like this
`
class EnOceanWallSwitch(EnOceanSensor):
"""Representation of an EnOcean wall switch.
EEPs (EnOcean Equipment Profiles):
- F6-02-01
"""

def value_changed(self, packet):
    """Update the internal state of the sensor."""
    action = packet.data[1]

    if action == 0x00:
        self._attr_native_value = "release"
    if action == 0x30:
        self._attr_native_value = "BP1"
    if action == 0x10:
        self._attr_native_value = "BP2"
    if action == 0x70:
        self._attr_native_value = "BP3"
    if action == 0x50:
        self._attr_native_value = "BP4"
    if action == 0x37:
        self._attr_native_value = "BP1+3"
    if action == 0x15:
        self._attr_native_value = "BP2+4"
    if action == 0x17:
        self._attr_native_value = "BP2+3"
    if action == 0x35:
        self._attr_native_value = "BP1+4"

    self.schedule_update_ha_state()

`

I think it's better like this

I insist because one of our customers who buys our products works under HA.

best regards

@MartinHjelmare
Copy link
Member

No, all Enocean protocol details need to be extracted to a 3rd party library published in PyPI.

Example: The integration should not need to know what 0x00 means in the Enocean protocol.

The library should abstract the details into human readable objects and attributes.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants