#Control a led with Home Assistant?

60 messages · Page 1 of 1 (latest)

autumn robin
#

I thought it would be cool to control a LED diode with HA. First, I connected it to my Arduino. I loaded a script called Firmata. Intro the config file i wrote this:

firmata:
  - serial_port: /dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_55736303739351811011-if00
    lights:
      - name: my_dimmable_light
        pin_mode: PWM
        pin: 13
```but I got an error:```
Logger: homeassistant.components.firmata.config_flow
Source: components/firmata/config_flow.py:41
integration: Firmata (documentation, issues)
First occurred: 11:11:57 AM (1 occurrences)
Last logged: 11:11:57 AM

Error connecting to PyMata board serial-/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_55736303739351811011-if00: Invalid Arduino ID reply length```


Things to mention:
- HA is running on Raspberry Pi 3
- Arduino UNO
- Led on pin 13
- I'm new to home assistant
molten oracle
#

Do you have firmata installed on your arduino?

autumn robin
molten oracle
#

It's something you've gotta load onto it, so if you don't know the answer is probably not ^^

#

You can also expose the pi's i/o ports for stuff like that too BTW, don't need a separate board

autumn robin
#

i donwloaded it:

molten oracle
#

And it's loaded on the board, not just installed in the ide?

autumn robin
molten oracle
#

Hmmm weird

#

I'll have to dig out one of my duino boards and see what's going on, been a while since I used firmata

autumn robin
molten oracle
#

Fair enough

#

That's the sort of thing I use esphome for tbh

autumn robin
#

with the wifi module?

#

I also thought of that, but i wanted to try it with my arduino board, just becuse i don't have ESP

molten oracle
#

Nothing interesting, I followed the steps in that thing I linked and it blinks an led just fine

molten oracle
#

Nope, just the pc - but the firmata integration just uses the same commands so if it works on one it will work on the other

autumn robin
molten oracle
#

I just wrote something in python using this

autumn robin
#

i found this, and blinks too

#

so there's gotta be problem with HA

#

Note: I have here output

#

no PWM

molten oracle
#

OK, so I guess the things to check are a) the usb port is correct and b) home assistant has access to that port (if it's in a vm or container)

autumn robin
molten oracle
#

If you're seeing it in home assistant it has access

autumn robin
#

It is recommended to use the by-id reference (instead of numerical like /dev/ttyACM0 or /dev/ttyUSB0) since these will never change after a reboot

#

the first one is like this:

BUSNUM: '001'
DEVNAME: /dev/bus/usb/001/011
DEVNUM: '011'
DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
DEVTYPE: usb_device
DRIVER: usb
ID_BUS: usb
ID_MODEL: '0043'
ID_MODEL_ENC: '0043'
ID_MODEL_ID: '0043'
ID_PATH: platform-3f980000.usb-usb-0:1.2
ID_PATH_TAG: platform-3f980000_usb-usb-0_1_2
ID_PATH_WITH_USB_REVISION: platform-3f980000.usb-usbv2-0:1.2
ID_REVISION: '0001'
ID_SERIAL: Arduino__www.arduino.cc__0043_55736303739351811011
ID_SERIAL_SHORT: '55736303739351811011'
ID_USB_INTERFACES: ':020201:0a0000:'
ID_USB_MODEL: '0043'
ID_USB_MODEL_ENC: '0043'
ID_USB_MODEL_ID: '0043'
ID_USB_REVISION: '0001'
ID_USB_SERIAL: Arduino__www.arduino.cc__0043_55736303739351811011
ID_USB_SERIAL_SHORT: '55736303739351811011'
ID_USB_VENDOR: Arduino__www.arduino.cc_
ID_USB_VENDOR_ENC: Arduino\x20\x28www.arduino.cc\x29
ID_USB_VENDOR_ID: '2341'
ID_VENDOR: Arduino__www.arduino.cc_
ID_VENDOR_ENC: Arduino\x20\x28www.arduino.cc\x29
ID_VENDOR_ID: '2341'
MAJOR: '189'
MINOR: '10'
PRODUCT: 2341/43/1
SUBSYSTEM: usb
TYPE: 2/0/0
USEC_INITIALIZED: '7977636808'
#

and the second:```
DEVLINKS: >-
/dev/serial/by-id/usb-Arduino__www.arduino.cc__0043_55736303739351811011-if00
/dev/serial/by-path/platform-3f980000.usb-usb-0:1.2:1.0
/dev/serial/by-path/platform-3f980000.usb-usbv2-0:1.2:1.0
DEVNAME: /dev/ttyACM0
DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/tty/ttyACM0
ID_BUS: usb
ID_MODEL: '0043'
ID_MODEL_ENC: '0043'
ID_MODEL_ID: '0043'
ID_PATH: platform-3f980000.usb-usb-0:1.2:1.0
ID_PATH_TAG: platform-3f980000_usb-usb-0_1_2_1_0
ID_PATH_WITH_USB_REVISION: platform-3f980000.usb-usbv2-0:1.2:1.0
ID_REVISION: '0001'
ID_SERIAL: Arduino__www.arduino.cc__0043_55736303739351811011
ID_SERIAL_SHORT: '55736303739351811011'
ID_TYPE: generic
ID_USB_DRIVER: cdc_acm
ID_USB_INTERFACES: ':020201:0a0000:'
ID_USB_INTERFACE_NUM: '00'
ID_USB_MODEL: '0043'
ID_USB_MODEL_ENC: '0043'
ID_USB_MODEL_ID: '0043'
ID_USB_REVISION: '0001'
ID_USB_SERIAL: Arduino__www.arduino.cc__0043_55736303739351811011
ID_USB_SERIAL_SHORT: '55736303739351811011'
ID_USB_TYPE: generic
ID_USB_VENDOR: Arduino__www.arduino.cc_
ID_USB_VENDOR_ENC: Arduino\x20\x28www.arduino.cc\x29
ID_USB_VENDOR_ID: '2341'
ID_VENDOR: Arduino__www.arduino.cc_
ID_VENDOR_ENC: Arduino\x20\x28www.arduino.cc\x29
ID_VENDOR_ID: '2341'
MAJOR: '166'
MINOR: '0'
SUBSYSTEM: tty
TAGS: ':systemd:'
USEC_INITIALIZED: '7977653466'

molten oracle
#

The latter

autumn robin
molten oracle
#

by-id

#

You didn't set the baud rate

#

serial_baud_rate: 57600

autumn robin
# molten oracle serial_baud_rate: 57600
Logger: homeassistant.components.firmata.config_flow
Source: components/firmata/config_flow.py:49
integration: Firmata (documentation, issues)
First occurred: 5:03:14 PM (1 occurrences)
Last logged: 5:03:14 PM

Error connecting to serial port for PyMata board serial-57600: [Errno 2] could not open port 57600: [Errno 2] No such file or directory: '57600'
molten oracle
#

No... Not the serial port

autumn robin
#

i get it

autumn robin
molten oracle
#

What you originally had

#

It was fine

#

I think you just didn't set the baud rate so it couldn't communicate

autumn robin
molten oracle
#

Yes

#

Though with the underscores

autumn robin
#

yep, i forgot to format it

autumn robin
#

but the led is not working

molten oracle
#

I dunno man, feels like an arduino issue at that point

#

Check your pin is correct, check out can be operated as pwm

autumn robin
molten oracle
#

Wirelessly?

autumn robin
#

well, not exactly wirelessly, i guess that if i don't have a wifi module, or anything like that, i have to do it with my PC or something