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

Use 0/1 for raspberry pi cover GPIO writes rather than true/false #13610

Merged
merged 2 commits into from Apr 1, 2018
Merged

Use 0/1 for raspberry pi cover GPIO writes rather than true/false #13610

merged 2 commits into from Apr 1, 2018

Conversation

fezfox
Copy link
Contributor

@fezfox fezfox commented Apr 1, 2018

Description:

Raspberry pi GPIO pins don't appear to respond to true/false writes and I have found that for this reason the raspberry pi GPIO cover doesn't appear to work. Other HA code that writes to the RPi GPIO pins is written differently, for example, in \components\switch\rpio_gpio.py the following code is used:

    def turn_on(self, **kwargs):
        """Turn the device on."""
        rpi_gpio.write_output(self._port, 0 if self._invert_logic else 1)
        self._state = True
        self.schedule_update_ha_state()

This code works. Hence this PR uses 0/1 in the raspberry pi GPIO cover, instead of true/false.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

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

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

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

GPIO pins don't appear to respond to true/false writes, and this is reflected in code elsewhere. For example, in `\components\switch\rpio_gpio.py` the following code is used:

```
    def turn_on(self, **kwargs):
        """Turn the device on."""
        rpi_gpio.write_output(self._port, 0 if self._invert_logic else 1)
        self._state = True
        self.schedule_update_ha_state()
```

This code works. Hence this PR uses 0/1 in the raspberry pi GPIO cover, instead of true/false.
@homeassistant
Copy link
Contributor

Hi @fezfox,

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!

@fezfox fezfox changed the title Use 0/1 for GPIO writes rather than true/false Use 0/1 for raspberry pi cover GPIO writes rather than true/false Apr 1, 2018
@balloob balloob merged commit dee47d5 into home-assistant:dev Apr 1, 2018
@balloob
Copy link
Member

balloob commented Apr 1, 2018

Thanks! Nice catch. 🐬

@balloob balloob mentioned this pull request Apr 13, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants