lolouk44 / CurrentCost_HA_CC

CurrentCost Meter Reading Custom Component for Home Assistant
16 stars 7 forks source link

Additional documentation for HA in Docker #16

Closed digdilem closed 2 years ago

digdilem commented 2 years ago

Hi - Thanks for this. I've previously been capturing currentcost data with my own perl script, then injecting readings into a mariadb database, then using sql queries to get that into HA - quite the convoluted path, and your method is much nicer.

As quite a few people are using HA in docker, I thought it might be useful to add some documentation on doing this, so I've sketched it out below in the hope it's useful.

===== Running HA in docker means it does not, by default, have access to USB ports. But they can be passed through.

If using docker-compose (recommended), add this to your docker-compose.yml file to pass through the port (Host -> Container)

    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0

If running docker alone: Use --device=/dev/ttyUSB0 on the docker run command line.

Sometimes the by-id path doesn't expand for me, and you may need to play around udevd rules to get a consistent path for thi,s especially if you're using more than one USB device on the host.

You can also use privileged mode in both forms to pass through all local devices, but this does have some security concerns.

lolouk44 commented 2 years ago

Thanks for your suggestions. However it in a way has very little to do with the custom component. Anybody using docker (I'm one of them) would/should know about this. If I start documenting Docker, I will also have to potentially maintain doc for all other installation methods.