redmekool / ha-raspberry-pi-gpio-pwm Goto Github PK
View Code? Open in Web Editor NEWHome Assistant component rpi_gpio_pwm as a custom component
License: MIT License
Home Assistant component rpi_gpio_pwm as a custom component
License: MIT License
please update repository structure so it can be added into HACS. thank you
I'm not finding the integration via HACS 1.25 or 1.26. Is the version not compatible ?
The frequency is stated as default 100. Is this not the duty cycle ? So 100 = 100% on, 50 = 50% dimmed and 0 = off ?
Hello,
Thanks for your efforts in continuing to support the rpi_gpio_pwm!
Before 2022.04 I used rpi_gpio_pwm for integration with i2c module PCA9685 connected directly to rpi with configuration like:
light:
- platform: rpi_gpio_pwm
leds:
- name: Strip1
driver: pca9685
frequency: 1526
pins: [0]
type: simple
Obviously and unfortunately after deprecation of rpi_gpio_pwm from HA side it's not possible anymore.
So, my question is: is it possible to use this custom component with PCA9685? if no does someone have a plan to add support of this?
Thanks
Hey,
I was just wondering if you plan to add support for rgb leds
Best wishes
I am very new and I thought I didd everything as described... may be not.
my log:
2023-11-18 17:18:48.318 ERROR (SyncWorker_2) [homeassistant.loader] Error loading integration: rpi_gpio_pwm
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 867, in _resolve_integrations_from_root
integration = Integration.resolve_from_root(hass, root_module, domain)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 573, in resolve_from_root
integration = cls(
^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 645, in init
_LOGGER.info("Loaded %s from %s", self.domain, pkg_path)
^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 660, in domain
return self.manifest["domain"]
~~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'domain'
How can I fix that? Domain seems to be somewhere missing?
Thank you so much
HA OS has been updated to core-2022.7.5 including an update to python 3.10.5. this is now causing issues with HA. My use case is the PCA 9685 which this had. Would be nice to have an alternative.
If the HA-Raspberry-pi-GPIO-PWM (installed with HACS) is set up in the configuration.yaml the configuration validation is not able to finish and the system thus cannot restart.
Steps I tried:
reinstallation
manual installation
previous version (does not work no more)
Getting the error
Invalid config for [light.rpi_gpio_pwm]: [host] is an invalid option for [light.rpi_gpio_pwm]. Check: light.rpi_gpio_pwm->host. (See ?, line ?).
My conf is:
`
light:
Pretty much from the example. I noted that CONF_HOST = was missing from light.py, so i tried adding it but to no avail. Any assistance with this please?
Hi,
My HA is 2023.7.2
I installed as expected in the read.me with Manual installation.
Setting up rpi_gpio_pwm in configuration.yaml
# add Bernard
switch:
- platform: rpi_gpio
switches:
- port: 17
name: "Fan Office"
unique_id: "fan_office_switch_port_17"
sensor:
- platform: command_line
name: "X CPU Temp"
command: "cat /sys/class/thermal/thermal_zone0/temp"
unit_of_measurement: "°C"
value_template: "{{ value | multiply(0.001) | round(1) }}"
scan_interval: 10
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_utc'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
- 'beat'
light:
- platform: rpi_gpio_pwm
leds:
- name: RPI Cooling Fan
pin: 18
climate:
- platform: generic_thermostat
name: RPI Cooling Fan Controller
unique_id: rpi_cooling_fan_controller
heater: light.rpi_cooling_fan
target_sensor: sensor.X_CPU_Temp
min_temp: 30
max_temp: 70
ac_mode: true
target_temp: 30
cold_tolerance: 0.1
hot_tolerance: 0.1
min_cycle_duration:
seconds: 30
keep_alive:
minutes: 1
initial_hvac_mode: "cool"
2023-07-26 14:34:25.382 ERROR (MainThread) [homeassistant.components.light] Error while setting up rpi_gpio_pwm platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 353, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ha-rpi_gpio_pwm/light.py", line 70, in setup_platform
opt_args["pin_factory"] = PiGPIOFactory(host=led_conf[CONF_HOST], port= led_conf[CONF_PORT])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/gpiozero/pins/pigpio.py", line 101, in __init__
raise IOError('failed to connect to %s:%s' % (host, port))
OSError: failed to connect to localhost:8888
Have you an idea to solve this issue.
BR
Bernard
Logger: homeassistant.config
Source: custom_components/rpi_gpio_pwm/light.py:8
Integration: rpi_gpio_pwm
First occurred: 07:18:58 (1 occurrences)
Last logged: 07:18:58
Platform error: light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config.py", line 877, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 618, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 635, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.9/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1030, in _gcd_import
File "", line 1007, in _find_and_load
File "", line 986, in _find_and_load_unlocked
File "", line 680, in _load_unlocked
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/config/custom_components/rpi_gpio_pwm/light.py", line 8, in
from pwmled.driver.pca9685 import Pca9685Driver
File "/usr/local/lib/python3.9/site-packages/pwmled/driver/pca9685.py", line 6, in
import board
File "/usr/local/lib/python3.9/site-packages/board.py", line 62, in
from adafruit_blinka.board.raspberrypi.raspi_4b import *
File "/usr/local/lib/python3.9/site-packages/adafruit_blinka/board/raspberrypi/raspi_4b.py", line 3, in
from adafruit_blinka.microcontroller.bcm2711 import pin
File "/usr/local/lib/python3.9/site-packages/adafruit_blinka/microcontroller/bcm2711/pin.py", line 2, in
import RPi.GPIO as GPIO
ModuleNotFoundError: No module named 'RPi'
2022.7.0 was released a couple of hours ago. After upgrading I saw in the logs that both python dependencies of this package can't be installed (sorry I don't have the logs as I immediately rolled back). My guess is that it has to do with python 3.10 being used in that version. As I see that both dependencies were not released in a couple of months, I'm guessing that there is not much you can do about it... I will try to update again when I have the time so I can extract the logs and post them here
The homeassistant ui won't let me edit the entities that are created by this integration, because they don't have a unique_id.
Could you add support for unique_ids? Maybe generate them automatically or add the "unique_id" key as an optional key to the configuration something like:
light:
- platform: rpi_gpio_pwm
leds:
- name: RPI Cooling Fan
unique_id: rpi_cooling_fan
pin: 13
frequency: 25000
Hello,
I'm on home assistant core-2022.6.5. When I try to validate my configuration I have : Platform error light.rpi_gpio_pwm - Integration 'rpi_gpio_pwm' not found.
In the configuration.yaml file :
light:
I did manual installation, because not available in HACS
May thanks in advance for help
Guillaume
Configuration:
light:
platform: rpi_gpio_pwm
leds:
- name: System Cooling Fan
pin: 18
Following error occurs, when I want to turn on/off or change brightness of the light:
Logger: homeassistant.components.automation.system_fan_control
Source: custom_components/rpi_gpio_pwm/light.py:125
Integration: Automatisierung (documentation, issues)
First occurred: 03:06:56 (2772 occurrences)
Last logged: 08:15:30
System: Fan control: Choose at step 1: choice 2: Error executing script. Unexpected error for call_service at pos 1: [Errno 32] Broken pipe
System: Fan control: Error executing script. Unexpected error for choose at pos 1: [Errno 32] Broken pipe
While executing automation automation.system_fan_control
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 447, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 680, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1713, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1750, 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 930, 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/components/light/init.py", line 553, in async_handle_light_on_service
await light.async_turn_on(**filter_turn_on_params(light, params))
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 984, in async_turn_on
await self.hass.async_add_executor_job(ft.partial(self.turn_on, **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_pwm/light.py", line 125, in turn_on
self._led.value = _from_hass_brightness(self._brightness)
File "/usr/local/lib/python3.10/site-packages/gpiozero/devices.py", line 132, in setattr
return super(GPIOBase, self).setattr(name, value)
File "/usr/local/lib/python3.10/site-packages/gpiozero/output_devices.py", line 448, in value
self._write(value)
File "/usr/local/lib/python3.10/site-packages/gpiozero/output_devices.py", line 435, in _write
super(PWMOutputDevice, self)._write(value)
File "/usr/local/lib/python3.10/site-packages/gpiozero/output_devices.py", line 96, in _write
self.pin.state = self._value_to_state(value)
File "/usr/local/lib/python3.10/site-packages/gpiozero/pins/init.py", line 285, in
lambda self, value: self._set_state(value),
File "/usr/local/lib/python3.10/site-packages/gpiozero/pins/pigpio.py", line 244, in _set_state
value = int(value * self.factory.connection.get_PWM_range(self.number))
File "/usr/local/lib/python3.10/site-packages/pigpio.py", line 1543, in get_PWM_range
return _u2i(_pigpio_command(self.sl, _PI_CMD_PRG, user_gpio, 0))
File "/usr/local/lib/python3.10/site-packages/pigpio.py", line 1025, in _pigpio_command
sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
BrokenPipeError: [Errno 32] Broken pipe
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.