GithubHelp home page GithubHelp logo

thecode / ha-rpi_gpio Goto Github PK

View Code? Open in Web Editor NEW
172.0 172.0 39.0 185 KB

Home Assistant Raspberry Pi GPIO Integration

License: Apache License 2.0

Python 100.00%
custom-component hacktoberfest home-assistant home-automation homeassistant iot raspberry-pi rpi-gpio

ha-rpi_gpio's Introduction

Hi, I'm Shay Levy twitter linkedin discord

Let's see how I did this year:

Github stats

ha-rpi_gpio's People

Contributors

dependabot[bot] avatar ludeeus avatar thecode avatar tomer-w avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-rpi_gpio's Issues

Impossible to update custom component after 2022.07 Home Assistant update

Logger: homeassistant.components.hassio
Source: components/hassio/init.py:682
Integration: Home Assistant Supervisor (documentation, issues)
First occurred: July 7, 2022 at 11:53:38 PM (2 occurrences)
Last logged: July 7, 2022 at 11:56:30 PM

The system cannot restart because the configuration is not valid: Platform error switch.rpi_gpio - Integration 'rpi_gpio' not found. Platform error switch.rpi_gpio - Requirements for rpi_gpio not found: ['RPi.GPIO==0.7.1a4'].

DHT22

Hi,,
I couldn't find the configuration for the binary sensor DHT22.
How can i configure my DHT22 which is connected to GPIO 04 in Raspberry pi?

Can't add a switch

I want to control the CPU fan on my Raspberry Pi 3, so I've added the Home Assistant Raspberry Pi GPIO custom integration through HACS. Then I've added the following to /root/config/configuration.yaml:

switch:
  - platform: rpi_gpio
    switches:
      - port: 3
        name: "Fan"

I've restarted Home Assistant, but I don't have an entity called "Fan". Also, there's nothing in the log about "fan" or "gpio". What am I doing wrong?

walking in the dark - literally

Hi, any help will bem greatly appreciated, because I am actually in a dark home using flashlights to see at night. All my lighting is controlled by 32 relays through rasp gpios.
I am running a rasp 3 64 bit, Home Assistant Core 2022.6.7
Home Assistant Supervisor 2022.05.3,
Home Assistant OS 8.2

I have both tried HACS and also have manually created the custom_components and rpi_gpio folders and placed rpi_gpio contents on it with no success.

2022-07-01 21:12:37 ERROR (SyncWorker_8) [homeassistant.util.package] Unable to install package RPi.GPIO==0.7.1: error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/RPi
copying RPi/init.py -> build/lib.linux-aarch64-cpython-39/RPi
creating build/lib.linux-aarch64-cpython-39/RPi/GPIO
copying RPi/GPIO/init.py -> build/lib.linux-aarch64-cpython-39/RPi/GPIO
running build_ext
building 'RPi._GPIO' extension
creating build/temp.linux-aarch64-cpython-39
creating build/temp.linux-aarch64-cpython-39/source
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c source/c_gpio.c -o build/temp.linux-aarch64-cpython-39/source/c_gpio.o
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for RPi.GPIO
error: subprocess-exited-with-error
× Running setup.py install for RPi.GPIO did not run successfully.
│ exit code: 1
╰─> [17 lines of output]
running install
/usr/local/lib/python3.9/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build/lib.linux-aarch64-cpython-39
creating build/lib.linux-aarch64-cpython-39/RPi
copying RPi/init.py -> build/lib.linux-aarch64-cpython-39/RPi
creating build/lib.linux-aarch64-cpython-39/RPi/GPIO
copying RPi/GPIO/init.py -> build/lib.linux-aarch64-cpython-39/RPi/GPIO
running build_ext
building 'RPi._GPIO' extension
creating build/temp.linux-aarch64-cpython-39
creating build/temp.linux-aarch64-cpython-39/source
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c source/c_gpio.c -o build/temp.linux-aarch64-cpython-39/source/c_gpio.o
error: command 'gcc' failed: No such file or directory
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> RPi.GPIO
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

No devices/entities present in dashboard or otherwise

Hi! I'm running Home Assistant v2022.8.6 in a docker container. I've installed HACS and rpi_gpio, and have the following configuration.yaml:

# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:
  - platform: google_translate

# RPi GPIO
switch:
  - platform: rpi_gpio
    switches:
      - port: 21
        name: "Stove"
        unique_id: "stove"
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

HA UI shows I've got a valid config with RPi GPIO Entities, but "Stove" is not showing up anywhere in home assistant. Any suggestions?

Switch not working

Can't get the switch to work: when i restart Hass I do here my relais going off, but when I use the switch in hass nothing happens

Hacs download not working

I really dunno why, but this integration does not install from Hacs, unlike the other integrations, the download / installation does not continue in background

ModuleNotFoundError: No module named 'RPi' when setting up the platform

On 2023.7.1 with ha-rpi_gpio installed via HACS on vanilla Home Assistant OS on an RPi4 I get:

2023-07-07 16:02:23.581 ERROR (MainThread) [homeassistant.config] Platform error: switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 924, in async_process_component_config
    platform = p_integration.get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/rpi_gpio/__init__.py", line 3, in <module>
    from RPi import GPIO  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'RPi'

On 2023.6.3 all works normally.

Requirements for rpi_gpio not found: ['RPi.GPIO==0.7.1']

I have installation issues with 2022.7.0 of HA running in a docker container.
I followed the recommendations given in the (identical but closed) issue #83, I tried to remove rpi_gpio from my config, uninstall integration, restart HA, install integration, restart HA, and everything is fine in the log. But as soon I add the rpi_gpio integration config in the yaml, I get the installation error in the log during the config check :
Platform error switch.rpi_gpio - Requirements for rpi_gpio not found: ['RPi.GPIO==0.7.1'].

And more detail in the container's log :

2022-07-07 11:59:56 ERROR (SyncWorker_1) [homeassistant.util.package] Unable to install package RPi.GPIO==0.7.1: error: subprocess-exited-with-error
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running build
      running build_py
      creating build
      creating build/lib.linux-armv7l-cpython-310
      creating build/lib.linux-armv7l-cpython-310/RPi
      copying RPi/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi
      creating build/lib.linux-armv7l-cpython-310/RPi/GPIO
      copying RPi/GPIO/__init__.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO
      running build_ext
      building 'RPi._GPIO' extension
      creating build/temp.linux-armv7l-cpython-310
      creating build/temp.linux-armv7l-cpython-310/source
      error: command 'gcc' failed: No such file or directory
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for RPi.GPIO
  error: subprocess-exited-with-error
  × Running setup.py install for RPi.GPIO did not run successfully.
  ╰─> [17 lines of output]
      running install
      /usr/local/lib/python3.10/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> RPi.GPIO
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

The YAML looks like this :

- platform: rpi_gpio
  switches:
    - port: 5
      name: "Volet Cuisine Montée"
      invert_logic: true
    - port: 6
      name: "Volet Cuisine Descente"
      invert_logic: true
    - port: 13
      name: "Volet Baie Sud-Est Montée"
      invert_logic: true
    - port: 16
      name: "Volet Baie Sud-Est Descente"
      invert_logic: true
    - port: 19
      name: "Volet Baie Sud-Ouest Montée"
      invert_logic: true
    - port: 20
      name: "Volet Baie Sud-Ouest Descente"
      invert_logic: true
    - port: 21
      name: "Volet Bureau Montée"
      invert_logic: true
    - port: 26
      name: "Volet Bureau Descente"
      invert_logic: true

GPIO based switch skipps second GPIO

I have a Raspberry Pi 4 running Home Assistant. I have been using it for automation of my covers using two relays:
Relay 1: NC: disconnect manual wall switch
NO: power to Relay 2
Relay 2: NC: travel UP
NO: travel DOWN
Relays are connected to 3v3 to 24V converter which powers the relays.
So if I want the covers to move up, I just switch on Relay 1 (using a GPIO). If I want to close the covers, I need to switch both relays at once. This was working well with the below code till the migration to rpi_gpio using the below code:

`switch:

  • platform: rpi_gpio
    ports:
    6: Žalúzie 1 # Detská pravá
    13: Žalúzie 2 #
  • platform: template
    switches:
    detska_p_zaluzie_hore: #UP
    turn_on:
    - service: switch.turn_off
    target:
    entity_id: switch.zaluzie_2
    - service: switch.turn_on
    target:
    entity_id: switch.zaluzie_1
    turn_off:
    - service: switch.turn_off
    target:
    entity_id: switch.zaluzie_1
    - service: switch.turn_off
    target:
    entity_id: switch.zaluzie_2
    detska_p_zaluzie_dole: #DOWN
    turn_on:
    - service: switch.turn_on
    target:
    entity_id: switch.zaluzie_1
    - service: switch.turn_on
    target:
    entity_id: switch.zaluzie_2
    turn_off:
    - service: switch.turn_off
    target:
    entity_id: switch.zaluzie_1
    - service: switch.turn_off
    target:
    entity_id: switch.zaluzie_2

cover:

  • platform: cover_time_based_synced
    devices:
    zaluzie_detska_l_ovladanie:
    name: Žalúzie detská ľavá
    travelling_time_up: 38
    travelling_time_down: 38
    close_switch_entity_id: switch.detska_l_zaluzie_dole
    open_switch_entity_id: switch.detska_l_zaluzie_hore
    send_stop_at_ends: True #optional
    aliases: #optional
    - zaluzie_detska_l_time_based`

Now, the travel DOWN sometimes does not work. The automation or cover switch in HA to move down only turns on Relay 1 and the covers are opening instead of closing. I use it for 8 windows and every day it randomly skips some of the covers. Also pressing the down arrow in HA sometimes works well and sometimes not. So it randomly skipps the second service in my switch.

Controlling PWM fan on Pi4

With the old rpi_gpio integration I could control my pwm fan locally on my RPi4.

light:
  - platform: rpi_gpio_pwm
    leds:
      - name: RPI Cooling Fan
        driver: gpio
        pins: [18]
        type: simple

Then I could control my fan speed as if it was a light bulb with automations.

Will this integration be able to do the same. And if so, can you give an example?

Uncaught exception - Home Assistant 2022.2.9

Hi,

I have recently installed the custom rpi_gpio integration for Home Assistant 2022.2.9 via HACS. Although all the gpio attached switches and sensors are working within Home Assistant, I do see the follow error logged which comes up now and then.

This error originated from a custom integration.

Logger: root
Source: custom_components/rpi_gpio/binary_sensor.py:85
Integration: Raspberry Pi GPIO (documentation, issues)
First occurred: 9:00:21 AM (2 occurrences)
Last logged: 9:00:22 AM

Uncaught exception
Traceback (most recent call last):
File "/config/custom_components/rpi_gpio/binary_sensor.py", line 85, in edge_detected
self.hass.add_job(self.async_read_gpio)
AttributeError: 'NoneType' object has no attribute 'add_job'

Capture3

Capture

Capture2

1-wire with SysBus support

@thecode sorry for writing here, but I didn't find a better way.
As you probably know in HA 2022.6 GPIO support will be removed, and with it also 1-Wire SysBus will be gone (home-assistant/core#71232).
You did an awesome job by maintaining this repository and many (including me) are very grateful for that.
Do you use 1-Wire sensors in your setup? I have a homemade floor heating system that is controlled by 1-wire sensors, so I must stay with HA 2022.5.x.
maybe you could recommend other solution or maybe create a fork as you did with rpi_gpio.

Do you have a buy-me-a-coffee account or patreon? Many users would like to thank you not just by words :)

Invalid Configuration

The system cannot restart because the configuration is not valid: Invalid config for [binary_sensor.rpi_gpio]: expected a dictionary @ data['sensors'][0]. Got 'port:23 name:"Main_Door"'

Request for additions

To begin with I want to thank you for your dedication to keeping GPIOs active in RPI which are, for me, the reason that I remain loyal to Home assistant.
My question is: do you think it is also possible to have integration for DHT and I2C?
If you can give me a perspective to orient myself to the changes that I inevitably see myself forced to make.
Thanks again.

Unable to use switch

Unable to use this component due to following error on startup:

File "/config/custom_components/rpi_gpio/init.py", line 33, in setup
GPIO.setmode(GPIO.BCM)
AttributeError: module 'RPi.GPIO' has no attribute 'setmode'

Called with:

switch:
  - platform: rpi_gpio
    switches:
      - port: 11
        name: "Fan Office"
      - port: 12
        name: "Light Desk"

Already tried to update RPi libraries

RPi GPIO LED

Hi. Trying to control a LED using this. Installed fine. Added this to the configuration file:
`switch:

  • platform: rpi_gpio
    switches:
    • port: 21
      name: "RPi Green LED"
      unique_id: "rpi_green_LED_GPIO_21"
      invert_logic: false`

Problem: A new 'switch' does not appear on the overview screen. I am new to HA. Any ideas?

BTW, this adds a new binary sensor and works great:
`binary_sensor:

  • platform: rpi_gpio
    sensors:
    • port: 26
      name: "RPi Momentary Switch"
      unique_id: "rpi_mom_switch_GPIO_26"
      bouncetime: 80
      invert_logic: true
      pull_mode: "UP"`

RuntimeError: Conflicting edge detection already enabled for this GPIO channel

I've upgraded to HA version 2023.3.5 which has a new feature of "Quick reload".

I have a simple gpio input pin

- platform: rpi_gpio
  sensors:
    - port: 26
      name: Front Door Open

however after using the "Quick reload" feature (to pick up a change to a template), the sensor becomes unavailable.

Consulting the ha log, I found

2023-03-17 11:10:08.268 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up rpi_gpio platform for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 293, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/rpi_gpio/binary_sensor.py", line 77, in setup_platform
    RPiGPIOBinarySensor(
  File "/config/custom_components/rpi_gpio/binary_sensor.py", line 132, in __init__
    edge_detect(self._port, edge_detected, self._bouncetime)
  File "/config/custom_components/rpi_gpio/__init__.py", line 59, in edge_detect
    GPIO.add_event_detect(port, GPIO.BOTH, callback=event_callback, bouncetime=bounce)
RuntimeError: Conflicting edge detection already enabled for this GPIO channel

Performing a full restart on HA restores the sensor to correct behaviour.

One of the other components I use needed a fix for it to remain functional after a quick reload (see home-assistant/core#89684 ).

RuntimeError: Failed to add edge detection

Hello,

I'm using this addon for a long time, but just got error that I don't know how to solve.
This happened when I made a backup of a HA and restored it in another RPI (Both are 4 B). There was 2 binary sensors described, but I had to change the ID. After doing that I got this error. If I change back the ID error is gone, but the problem is I must find a way to change them.
P.S. If I paste code example of binary sensor I still get the error.

Thank you for your help

image
image

problem after upgrade of HA to 2022.6

from configuration.yaml:

cover:
  - platform: rpi_gpio
    relay_time: 0.1
    invert_relay: false
    state_pull_mode: "UP"
    invert_state: true
    covers:
      - relay_pin: 17
        name: "ha esp32 reset"

from log:

Logger: homeassistant.components.cover
Source: custom_components/rpi_gpio/cover.py:75
Integration: Cover ([documentation](https://www.home-assistant.io/integrations/cover), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+cover%22))
First occurred: 21:32:12 (1 occurrences)
Last logged: 21:32:12

Error while setting up rpi_gpio platform for cover
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
    await asyncio.shield(task)
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/rpi_gpio/cover.py", line 75, in setup_platform
    cover[CONF_STATE_PIN],
KeyError: 'state_pin'

Assigning to an area, adding unique_id

Hello
First things first - this is not much of an issue, more a feature request / discussion

I am new to ha environment, and I am having problems assigning reed switches connected using this integration (via HACS) to areas.
Can't also assign unique id to do that on GUI

Is this by design or am I doing something wrong?

Current config entry is pretty simple:

binary_sensor:
  - platform: rpi_gpio
    bouncetime: 80
    # invert_logic: true
    # pull_mode: "DOWN"
    ports:
      16: Front doors

MHZ19

Hi, I'm using a MH-Z19 CO2 and Temperature Sensor with Raspberry Pi GPIO UART (/dev/ttyS0). Works perfectly on current Hassio (2022.3.6) integration.

Does this custom integration support this sensor ? Can't find how to configure it to get its values.

Documentation clarifications

I am new to Home Assistant and to using the Raspberry Pi's GPIO system. I am trying to operate some Somfy blinds from within Home Assistant.

In rpi_gpio, platform types are binary_sensor, cover and switch. While binary_sensor is explained pretty clearly in the documentation, the purpose of cover and switch could be better explained.

switch: Is switch supposed to emulate a physical switch, i.e. a button with two positions, which once pressed stays in its current state? Example: a switch for a light.

cover: Is cover supposed to emulate a push button, by that I mean a button which you push once to open something and once again to close In that case, I find the name cover misleading since it is too restrictive. Further to that, the state_pin is required. But what to do if there is no sensor for the state (like in my case)? Is this platform then useless or can I specify a dummy state_pin?

Platform error, installed from HACS

                Platform error binary_sensor.rpi_gpio - Exception importing custom_components.rpi_gpio.binary_sensor

`binary_sensor:

  • platform: rpi_gpio
    host: 192.168.1.???
    sensors:
    • port: 17
      name: "Alarm Set"
    • port: 27
      name: "Alarm Activated"`

Any help woud be much appreciated

When using the rpi_gpio binary sensor platform, there are problems connecting devices that use selectable GPIO pins.

Hello!
The problem is the following:

I have z-wave devices. Inside the Home Assistant, interaction with them takes place through the integration of Z-Wave.Me (https://www.home-assistant.io/integrations/zwave_me). This integration, as far as I understand, in turn interacts with the Z-Way server, which I installed using the addon Z-Wave.Me (https://github.com/z-wave-me/ha-z-wave-me-addon/). And already the Z-Way server, in turn, manages a physical device - the Z-Wave transceiver RaZberry 7 Pro (https://z-wave.me/products/razberry/#slide-1 )... RaZberry 7 Pro, connected to the Raspberry Pi 4B GPIO bus, in particular, uses the GPIO14 and GPIO15 pins...
My actions:
a) install Home Assistant Raspberry Pi GPIO custom integration via HACS
b) add to the configuration.yaml the following lines:
binary_sensor:

  • platform: rpi_gpio
    sensors:
    • port: 15
      name: "GPIO 15"

c) restarting the system

After a reboot, actions with all z-wave devices become unavailable!!! It is impossible to manage devices, and their current statuses are also unavailable... Moreover, the devices become inaccessible not only through the Home Assistant, but also through the web interface of the Z-Way server!

I have not tested with GPIO14, but I think that everything will be the same there...

Next, I just delete from the configuration.yaml the following lines:

  • port: 15
    name: "GPIO 15"

I don't delete anything else, I don't delete Home Assistant Raspberry Pi GPIO custom integration...
Next, I reboot the system - and everything works again! But in this case, of course, I do not know the status of GPIO15 (which I originally wanted when installing your integration)...

Also for Raspberry Pi I use Argon ONE M.2 case (https://argon40.com/products/argon-one-m-2-case-for-raspberry-pi-4 ). This enclosure, in particular, uses the pins GPIO2, GPIO3 and GPIO4...
When added to the configuration.yaml lines concerning GPIO2 and GPIO3, after a reboot, there is an incorrect operation of the functions of this case associated with cutting off power from the case...
After removing the mentions of GPIO2 and GPIO3 from the configuration.yaml and the subsequent reboot everything starts working normally again!
But here's what's interesting: when added to the configuration.yaml lines concerning GPIO4 (as far as I understand, this pin "monitors" the pressing of the power button on the case) and the subsequent reboot, nothing bad happens!!! The power button on the case continues to function normally!!!

Please tell me why this is happening and how to fix it?
Of course, I would like to monitor the status of all GPIO pins, but at the same time, of course, I need normally functioning devices!

I have a suspicion that this is happening for the reason that the GPIO14 (TXD0) and GPIO15 (RXD0) pins works as the UART interface, the GPIO2 (SDA1) and GPIO3 (SCL1) pins works as the I2C interface, but the GPIO4 pin is like a "normal" GPIO ...
Is the problem really in this?
If this is really the case, then what to do? How to fix the situation?

In any case,I look forward to your response!

upgrading from 2022.6.6 to 2022.7.6

Hello,
I've tried the uprade but lots of problem since was non possible to compile GPIO. I'm using your custom from 2022.6
Can you explain me the procedure to correctly upgrade since I think you did an upgrate to the platform.
Do I have to upgrade via HACS the integration before upgrade the platform ?
Thans.

Daniele

Remanent Outputs

Hi, i was wondering if this is a issue with Homeassistant or this plugin, but i use the GPIO to drive relays for my appliances (TV, Audio, PC etc.) and at each homeassistant restart (altered configuration.yaml needs the full restart) all pins will turn off.
Is there a possibility to make the gpio pins remanent?

RPI_GPIO Issue on HA core-2022.7.7 and rpi_gpio last version

Hi, I tried with all the suggestions in other posts but still not working.
Removed the configuration, restarted
Deleted RPI_GPIO, restarted
Installed RPI_GPIO, restarted
Added configuration, restarted

Here is the error:

The following integrations and platforms could not be set up:

[rpi_gpio](https://github.com/thecode/ha-rpi_gpio) 
rpi_gpio.binary_sensor
rpi_gpio.switch 

Here the configuration

switch:

  • platform: rpi_gpio
    invert_logic: true
    ports:
    5: Switch5_libero
    6: Luce sirena allarme_sw6
    13: Cicalino_inserimento_allarme_13
    19: Sirena_allarme_19

binary_sensor:

  • platform: rpi_gpio
    invert_logic: true
    ports:
    2: VOLUMETRICO BAGNO #GPIO2
    3: SENSORE PORTA BAGNO #GPIO3
    4: VOLUMETRICO GARAGE #GPIO4
    7: PORTA INGRESSO #GPIO7
    8: VOLUMETRICO SALA #GPIO8
    9: FREE

Can you help me?

How to get bme280 working with this?

Hi,

I have a bme280 connected to my Raspberry Pi 4 pins SDA and SCL. I had it working as in integration with earlier versions of HA.

What should my configuration.yaml entry look like for this?

pigpio Daemon PWM LED support

Hello, thank you for your effort. I am controlling my RGB LED Strip with rpi gpio will this feature be added to this integration too

How do you add it to trigger it?

I'm trying to create an Automation in home assistance.

How do I add a button in a trigger?

Here's my configuration.yaml file:

Loads default set of integrations. Do not remove.

default_config:

Text to speech

tts:

  • platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Full configuration.yaml entry

switch:

  • platform: rpi_gpio
    switches:
    • port: 2
      name: "Testing"
      unique_id: "testfan_office_switch_port_2"
      invert_logic: true

Remote GPIO

Is it possible to add the remote GPIO function as well?

Remote GPIO

Since HomeAssistant dropped remote gpio i'm looking for alternatives. So my new feature request is to add remote GPIO so that I can use GPIO of a remote PI - like I used to do in HA 2022.5 and earlier

.button integration

I'm actually happy this is now in the community hands.

I'm using the same rpi to run Hass and to controll many things.

One thing it does is controlling some switch latches (Puls to switch) over the GPIO.
After this update I was afraid it would be gone, but thanks to you it won't!

Now my question:
The best thing for me would if the GPIO could do a button "Pulse".

Now I configured them as switch --> touched and an automation turns off directly.
Then I have the pulse.

But it would be great if the "button" would be possible. So just a quick close of the relay and open again.

Possible?

Thanks!

Nothing happens on GPIO

Hi,
I was using my Raspberry Pi 3b to control some buttons and switches with Node-RED on the standard RPi OS. It worked fine.
Then I flashed and installed the Home Assistant OS RPi3x64 + HACS + ha-rpi_gpio and nothing happens when I activate any button !
I've put the button on my dashboard to check it, but nothing.
If I install then Node-RED as an add-on, it is unable to receive or control any GPIO.

Logs are empty exept :

2022-08-07 11:16:58.540 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration rpi_gpio which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-08-07 11:16:58.546 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

Here is my configuration.yaml for testing :
# Loads default set of integrations. Do not remove.
default_config:

# Text to speech
tts:

  • platform: google_translate

# Raspberry Pi GPIO Input
binary_sensor:

  • platform: rpi_gpio
    sensors:
    • port: 7
      name: "Bouton arrosage"

# Raspberry Pi GPIO Output
switch:

  • platform: rpi_gpio
    switches:
    • port: 37
      name: "Vanne arrosage"

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

Here is my System information :

Version core-2022.8.1
Installation Type Home Assistant OS
Development false
Supervisor true
Docker true
User root
Virtual Environment false
Python Version 3.10.5
Operating System Family Linux
Operating System Version 5.15.32-v8
CPU Architecture aarch64
Timezone Europe/Paris
Configuration Directory /config

Home Assistant Supervisor

Host Operating System Home Assistant OS 8.4
Update Channel stable
Supervisor Version supervisor-2022.07.0
Agent Version 1.2.1
Docker Version 20.10.14
Disk Total 6.7 GB
Disk Used 3.5 GB
Healthy true
Supported true
Board rpi3-64
Supervisor API ok
Version API ok
Installed Add-ons SSH & Web Terminal (12.0.0), File editor (5.3.3)

from homeassistant.components import rpi_gpio

I'm a newbie in reading home assistant code, so this may be way off base and a dumb question.
But in binary_sensor.py, cover.py, and switch.py, I see the following line:
from homeassistant.components import rpi_gpio

Won't this go away once rpi_gpio is removed as a default component in home assistant?
Should it point to this custom_component? Or does this custom component show up under homeassistant.components once installed?

I'm assuming you want this instance of rpi_gpio to be running stand alone prior to the actual removal of the original. So everyone can be testing it and confident that it is working before the transition.

Syntax errors when trying a HA restart after adjusting configuration.yaml after installing rpi_gpio from HACS

Hi, first a big thank you for keeping rpi_gpio up and running. I never understood the reason for removal from HA.

I'm using the Supervised version of HA. After installing from HACS the 6 version, I adjusted the description for the switch and binary_sensor in my configuration.yaml just the way you wrote it in the readme file. But when I tried to restart HA, I got errors on the syntax of the just entered lines. When I leave the description of the switch and binary_sensor unaltered, HA restarts without any problem. The automations that use rpi_gpio work just fine, so the installation seams succesfull.

All-in all there seams to be no need for adjusting the configuration.yaml after installing.

update 2022.2.3 to 2022.3.0 not updated after reboot

When I update from 2022.2.3 to 2022.3.0, and the download and install completes. Home Assist. directs me to restart.
Once the restart completes, Home Assist states the same version update is available for download and install.

After rollback integration doesn't load anymore

I’ve seen the issue #84 , but have a slightly different configuration.

After rolling back to 2022.6.7 (as 2022.7 has a problem with HomematicIP), I'm getting the same error as mentioned in #84. The integration was working before, though.

As I have rolled back, I also removed the integration and reinstalled an older one. I've tried 2022.6 and 2022.4, but both give the same error:

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [15 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-cpython-39
      creating build/lib.linux-aarch64-cpython-39/RPi
      copying RPi/__init__.py -> build/lib.linux-aarch64-cpython-39/RPi
      creating build/lib.linux-aarch64-cpython-39/RPi/GPIO
      copying RPi/GPIO/__init__.py -> build/lib.linux-aarch64-cpython-39/RPi/GPIO
      running build_ext
      building 'RPi._GPIO' extension
      creating build/temp.linux-aarch64-cpython-39
      creating build/temp.linux-aarch64-cpython-39/source
      gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-bu
iltin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.9 -c source/c
_gpio.c -o build/temp.linux-aarch64-cpython-39/source/c_gpio.o
      error: command 'gcc' failed: No such file or directory
      [end of output]

my system-health shows:
grafik

The symptoms are quite similar:

  1. I remove the configuration from config.yaml.
  2. I install the integration and reboot
  3. As soon as I add the configuration again and execute "verify configuration", the integration is loaded and the error above is written to the log

Any idea how to fix the problem?

Using single relay

I've connected a single relay on GPIO17 and trying to control it. I tried to change invert_logic but it didn't work. What should I do to handle the relay?

switch:
  - platform: rpi_gpio
    switches:
      - port: 17
        name: "Led Strip Relay"
        unique_id: "white_led_strip"
        invert_logic: true

MCP23017 integration or RPI-GPIO with I2C?

Hello
I use MCP23017 integration for a long time ago.
My home alarm is very stable using this integration and a all wired network sensors and switches.
(In the alarm system I prefer wired sensors and switches)

As I understood, we will loose it.
Is it possible to have MCP23017 integration in HACS?
This RPI-GPIO could have I2C?

Or I need to think about change my hardware...
Thanks for your work and contributions

Cannot restart after latest update

Hi there,

After updating to the latest core my supervised home assistant won't restart with the following error in the log:
The system cannot restart because the configuration is not valid: Platform error binary_sensor.rpi_gpio - Requirements for rpi_gpio not found: ['RPi.GPIO==0.7.1a4'].
The system cannot restart because the configuration is not valid: Platform error binary_sensor.rpi_gpio - Integration 'rpi_gpio' not found.

Better debounce

Today, I put a binary sensor on my door that I made myself and connected it to the raspberry pi's GPIO. I really like this integration although I have a little issue with the debounce feature. Basically, right now, the debounce also creates a delay after the door is closed. Closing some doors is very difficult (especially when it's night and everybody is sleeping). When closing this door, there's a decent amount of bouncing. Now this what I have a problem with. The debounce feature doesn't immediately tell me the door is closed if I have a debounce of 2 seconds. It waits for 2 seconds, and THEN tells me the door closed. When I suggest is the option to change the debounce algorithm. I'd like to have a debounce algorithm which would tell me the door is closed immediately after the first contact of the binary sensor. And if there's some bouncing while closing the door, ignore that bouncing. This is important because for example I want to set my music volume immediately to lower and not risk 2-3 false triggers while the door is closing (2-3 false door closings and opening, when in reality it was just one door opening with 2-3 bounces). Would this be possible?

Edit: To further clarify my point, I decided to add this part.

000000000000000000000000000000000000000000001111111111100000001111000111001010111111111111111111111
                                            |                                                     |
                                     HASS notified                        3 seconds after the signal

Basically, as soon as a change in the signal is detected, Home Assistant gets notified. After the change is detected, all other signals are ignored for a specific amount of time, let's say 3 seconds. After the three seconds, the Raspberry starts listening for changes again.

RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

2022-09-13 01:44:38.888 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall homeassistant.turn_off (c:01GCT1ECEX6Y5E5AC6SMT9N7VY): entity_id=['switch.fan_shim']>
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/core.py", line 1756, in catch_exceptions
await coro_or_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/components/homeassistant/init.py", line 124, in async_handle_turn_service
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/core.py", line 1738, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1775, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 676, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 931, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 713, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 993, in async_turn_off
await self.hass.async_add_executor_job(ft.partial(self.turn_off, **kwargs))
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/rpi_gpio/switch.py", line 116, in turn_off
write_output(self._port, 1 if self._invert_logic else 0)
File "/config/custom_components/rpi_gpio/init.py", line 49, in write_output
GPIO.output(port, value)
RuntimeError: Please set pin numbering mode using GPIO.setmode(GPIO.BOARD) or GPIO.setmode(GPIO.BCM)

Problem since upgrading to 2022.6.7

I use a devops pipeline for my HA yaml changes, and part of the pipeline executes a "ha core check" before restarting HA. I am pretty sure as I have upgraded to 2022.6.7 my pipelines fail at "ha core check" with the following:

pi@bhha:~/myagent/_work/_temp $ ha core check
Error: Testing configuration at /config
INFO:homeassistant.util.package:Attempting install of spotify_token==1.0.0
INFO:homeassistant.util.package:Attempting install of RPi.GPIO==0.7.1a4
ERROR:homeassistant.util.package:Unable to install package RPi.GPIO==0.7.1a4: error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [15 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-armv7l-cpython-310
creating build/lib.linux-armv7l-cpython-310/RPi
copying RPi/init.py -> build/lib.linux-armv7l-cpython-310/RPi
creating build/lib.linux-armv7l-cpython-310/RPi/GPIO
copying RPi/GPIO/init.py -> build/lib.linux-armv7l-cpython-310/RPi/GPIO
running build_ext
building 'RPi._GPIO' extension
creating build/temp.linux-armv7l-cpython-310
creating build/temp.linux-armv7l-cpython-310/source
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fno-semantic-interposition -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/local/include/python3.10 -c source/c_gpio.c -o build/temp.linux-armv7l-cpython-310/source/c_gpio.o
error: command 'gcc' failed: No such file or directory
[end of output]

** loads of similar errors after this all related to 'gcc' failed

Its possible I havent run the pipeline before the upgrade and the error may have come before 2022.6.7. The rpi.gpio covers I have still work in HA, so not sure if this error is to do with HA, rpi.gpio or my specific setup, if you could give me some pointers to look for?

Thanks, Alastair

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.