How to use the PWM LED component in hassio

How can I use the PWM LED Component in hassio on raspberry pi 3. When trying to turn on the light i turns back off and I am getting the following error in the log.

2017-11-13 17:25:10 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/tasks.py", line 181, in _step
    result = coro.throw(exc)
  File "/usr/lib/python3.6/site-packages/homeassistant/core.py", line 1038, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/light/__init__.py", line 280, in async_handle_light_service
    yield from light.async_turn_on(**params)
  File "/usr/lib/python3.6/asyncio/futures.py", line 331, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 244, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 244, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/light/rpi_gpio_pwm.py", line 145, in turn_on
    brightness=_from_hass_brightness(self._brightness))
  File "/usr/lib/python3.6/site-packages/pwmled/led/__init__.py", line 73, in set
    self._update_pwm()
  File "/usr/lib/python3.6/site-packages/pwmled/led/__init__.py", line 82, in _update_pwm
    self._driver.set_pwm(values)
  File "/usr/lib/python3.6/site-packages/pwmled/driver/__init__.py", line 56, in set_pwm
    self._set_pwm(self._to_raw_pwm(values))
  File "/usr/lib/python3.6/site-packages/pwmled/driver/gpio.py", line 30, in _set_pwm
    self._pi.set_PWM_dutycycle(self._pins[i], raw_values[i])
  File "/usr/lib/python3.6/site-packages/pigpio.py", line 1396, in set_PWM_dutycycle
    self.sl, _PI_CMD_PWM, user_gpio, int(dutycycle)))
  File "/usr/lib/python3.6/site-packages/pigpio.py", line 977, in _pigpio_command
    sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
AttributeError: 'NoneType' object has no attribute 'send'

Is it because the pigpio-daemon isn’t running, if so how do I install/start it in hassio.

My configuration of the pwm led component is the following:

light:
  - platform: rpi_gpio_pwm
    leds:
      - name: TV Light
        driver: gpio
        pins: [21]
        type: simple
1 Like

I have the same issue! Any solution?

I have almost the same problem.
I have install an rgb strip but it doesn’t open at all.
There is just an amorous light on the led and that’s all.

Same problem, too. With raspbian and HA, I startet the pigiod and everything was fine. But how to do it with hassio?

Same issue, any solution?

Still same issue with 0.63

Anyone have a solution?

I’m also having the same issue with the GPIO PWM component. I can’t figure out how to tell if pigpio daemon is running.
My PWM LED reports this:

Log Details (ERROR)
Sun Jan 06 2019 19:08:37 GMT-0600 (Central Standard Time)

Error handling message: {'type': 'call_service', 'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.pi_led'}, 'id': 14}
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/decorators.py", line 16, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
    connection.context(msg))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1121, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.6/site-packages/homeassistant/core.py", line 1143, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/__init__.py", line 270, in async_handle_light_on_service
    await light.async_turn_on(**pars)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/light/rpi_gpio_pwm.py", line 199, in turn_on
    color=_from_hass_color(self._color))
  File "/usr/local/lib/python3.6/site-packages/pwmled/led/rgb.py", line 55, in set
    super(RgbLed, self).set(is_on, brightness, cancel_transitions=False)
  File "/usr/local/lib/python3.6/site-packages/pwmled/led/__init__.py", line 75, in set
    self._update_pwm()
  File "/usr/local/lib/python3.6/site-packages/pwmled/led/__init__.py", line 84, in _update_pwm
    self._driver.set_pwm(values)
  File "/usr/local/lib/python3.6/site-packages/pwmled/driver/__init__.py", line 57, in set_pwm
    self._set_pwm(self._to_raw_pwm(values))
  File "/usr/local/lib/python3.6/site-packages/pwmled/driver/gpio.py", line 30, in _set_pwm
    self._pi.set_PWM_dutycycle(self._pins[i], raw_values[i])
  File "/usr/local/lib/python3.6/site-packages/pigpio.py", line 1396, in set_PWM_dutycycle
    self.sl, _PI_CMD_PWM, user_gpio, int(dutycycle)))
  File "/usr/local/lib/python3.6/site-packages/pigpio.py", line 977, in _pigpio_command
    sl.s.send(struct.pack('IIII', cmd, p1, p2, 0))
AttributeError: 'NoneType' object has no attribute 'send'

Count me in.

I’m still having the same issue in HA 0.87.0 and now HassOS 2.8. There’s still currently no way that I know to check if pigpio is running, or how to start the daemon in Hass at startup. I have a single RGB led connected to the gpio of the same Pi running HA. Can’t control it as a light. Really hoping a solution surfaces soon.

Got the same error on 0.88.2.

I trying to use the rpi_gpio_pwm platform but it doesn’t working. Can I use with Hass.io?
Thanks

Having the same issue… Any fix for using it on Hassio?

The same issue. Nobody knows answer? Thank you.

Error doing job: Task exception was never retrieved

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 363, in _async_add_entity
await entity.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/components/rpi_gpio_pwm/light.py”, line 179, in async_added_to_hass
await super().async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/components/rpi_gpio_pwm/light.py”, line 111, in async_added_to_hass
brightness=_from_hass_brightness(self._brightness))
File “/usr/local/lib/python3.7/site-packages/pwmled/led/rgb.py”, line 55, in set
super().set(is_on, brightness, cancel_transition=False)
File “/usr/local/lib/python3.7/site-packages/pwmled/led/init.py”, line 76, in set
self._update_pwm()
File “/usr/local/lib/python3.7/site-packages/pwmled/led/init.py”, line 85, in _update_pwm
self._driver.set_pwm(values)
File “/usr/local/lib/python3.7/site-packages/pwmled/driver/init.py”, line 52, in set_pwm
self._set_pwm(self._to_raw_pwm(values))
File “/usr/local/lib/python3.7/site-packages/pwmled/driver/gpio.py”, line 30, in _set_pwm
self._pi.set_PWM_dutycycle(self._pins[i], raw_values[i])
File “/usr/local/lib/python3.7/site-packages/pigpio.py”, line 1396, in set_PWM_dutycycle
self.sl, _PI_CMD_PWM, user_gpio, int(dutycycle)))
File “/usr/local/lib/python3.7/site-packages/pigpio.py”, line 977, in _pigpio_command
sl.s.send(struct.pack(‘IIII’, cmd, p1, p2, 0))
AttributeError: ‘NoneType’ object has no attribute ‘send’

I don’t know what error I got, because I haven’t looked at logs. However RPI GPIO PWM was not working with me too, but it the pigpiod daemon not running.

Check if it running with “pigs t” command.

installed it to run at startup with:

sudo systemctl enable pigpiod

Then reboot and you will see the pwm lights. Hope this helps.

I also had this problem and implemented a hass.io addon, which contains the pwm access with pigpid running inside.

Code + Plugin: https://github.com/Poeschl/Hassio-Addons/tree/master/pigpio
Install the repository as Addon-Source, install pigpid Addon and use the default Homeassistant component.

4 Likes

HI There,

I’m new to HA. And I do not get How things work. Can somebody help me?
I was enable to get SSH working and log in to HASSOS. But i can not for example give the pigs t command. it results in a “command not found” same for sudo and even apt commands fail.

What am I missing here?

Are you ssh’ing over the hassio addon? If so, you are not on the real host. Your are inside the docker container of the addon.

To access the host os you have to setup the debug ssh access. See following thread for help: How to get access at damn host system?

OMG!! Now I understand! I’m very sorry for this stupid question. Thanks for clearing that up!

For all who are not getting to install pigpio, this is what I did to get the addon working
In Supervisor>addon store select repositories
Add this url https://github.com/Poeschl/Hassos-Addons
And press add. After the spinner is completed get to the addon store and search for pigpio. This will bring up this addon for instal and then you start this.
Now reboot and you will not get any log of error of pwmled.

1 Like