W00D00 / home-assistant-elero

Elero Centero component
GNU General Public License v3.0
39 stars 10 forks source link

allow configuration of transmitter stick via environment variables #25

Closed tinkerdudeno1 closed 2 years ago

tinkerdudeno1 commented 2 years ago

As mentioned in #24, pyserial is not able to detect details of the comport which means that autodiscovery does not work. This is with the official HA Docker image (which is based on the Alpine image which is quite naked). I spend hours trying to get the serial number any other way avoiding the system limitations but eventually gave up. I thought the most elegant work-around would be to be able to set comport and serial number manually in the environment. If things are detected through pyserial: Cool. If not, you can alternatively set the environment variables like this: ELERO_DEVICE=/dev/ttyUSB1 and ELERO_SERIAL_NUMBER=A123B456 and the plugin will use these. I made sure the original behavior does not change if you do not set the env-variables so it just adds an alternative setup method for the transmitter stick. Hope this helps.

Weyel commented 1 year ago

Hi, thanks for your effort. I'm using HA Blue / Hardkernel Odroid-N2 and I'm having the same problem. I would like to set the "ELERO_DEVICE" and "ELERO_SERIAL_NUMBER", but I don't know how / where I can set this variables. Can you please tell me how I can set these two variables?

Thanks a lot in Advanced!

tinkerdudeno1 commented 1 year ago

Do you have shell access to your HA Blue? Via SSH or directly? ELERO_DEVICE and ELERO_SERIAL_NUMBER are environment variables. You can set these in a user context or system wide for all users. For the latter you could just edit /etc/environment (use sudo or root user and a shell editor of your choice) and add

ELERO_DEVICE=...
ELERO_SERIAL_NUMBER=...

Restart your system and HA should be able to find your transmitter.