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

binary sensors opto_in are not implemented #3

Open
litinoveweedle opened this issue Dec 11, 2024 · 2 comments
Open

binary sensors opto_in are not implemented #3

litinoveweedle opened this issue Dec 11, 2024 · 2 comments

Comments

@litinoveweedle
Copy link
Contributor

Hello, as title says, binary sensors for optical inputs are not implemented. This is probably caused by the missing implementation of the corresponding get_opto_in methods in the python library, where only get_all_opto() is implemented which is currently not directly usable via simple get command reference in the data.py.

Will you accept PR for multiio library extending support for get_opto_in(channel) method, so then optical binary sensors could be implemented in the SMmultiio-ha data.py?

Or do you prefer to implement per channel logic in the SMmultiio-ha directly?

@litinoveweedle
Copy link
Contributor Author

Checking python library I found that it contains get_opto implementation, so only its documentation in the README is missing.

    def get_opto(self, channel):
        """Get optocoupled input status. 

        Args:
            channel (int): Channel number

        Returns:
            (bool) Channel status
        """
        self._check_channel("opto", channel)
        opto_mask = self._get_byte(I2C_MEM.OPTO)
        if(opto_mask & (1 << (channel - 1))):
            return True
        else:
            return False

@litinoveweedle
Copy link
Contributor Author

litinoveweedle commented Dec 11, 2024

Proposed in PR #4

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

1 participant