CrazyIvan359 / mqttany

MQTTany is designed to make it easy to connect hardware on single board computers to your home automation solution.
https://crazyivan359.github.io/mqttany/index.html
MIT License
6 stars 6 forks source link

Derived classes do not work - fix names of class members in mcp230xx.py #105

Closed Jockra closed 3 years ago

Jockra commented 3 years ago

At least switching on the internal pull up resistors does not work, because of missing underscores of class member variables ( self._gpio, self._iodir, self._gppu). The derived class used its own variables.

CrazyIvan359 commented 3 years ago

Crap... I changed the registers from private (underscore) to public (no underscore) in #96 because of the warnings about accessing private attributes, I must have forgotten to do the same in the subclasses. Thanks for making a fix!

Occurrences of _gpio, _iodir, and _gppu should be changed to gpio, iodir, and gppu.

Also to pass the checks, if you are using VSCode, install the Python and Pylance extensions and install the formatter with pip install black. After that you can open the workspace file and code will be formatted automatically and errors will be highlighted. I will be adding instructions for that to CONTRIBUTING.md but have not gotten to it yet.