hassio-addons / addon-appdaemon

AppDaemon4 - Home Assistant Community Add-ons
https://addons.community
MIT License
149 stars 46 forks source link

RPI 4 Hassio+Appdaemon /dev/i2c-1 #249

Closed njscop closed 1 year ago

njscop commented 1 year ago

Problem/Motivation

Need to access /dev/i2c-1 from RPI 4 was able to few weeks ago.

Expected behavior

Up until now, the workaround was available: https://github.com/hassio-addons/addon-appdaemon/issues/169

I logged into supervisor and edited the addons.json after restart the Protection Mode button was available.

Actual behavior

Now it stopped working or does not let me save changes anymore and reverts them back as soon as I restart Core or the addon itself.

Steps to reproduce

1) Log into Supervisor 2) Edit /data/addons.json 3) In HA restart AppDaemon

Proposed changes

None - but I would expect any ideas for AppDaemon to be able to access /dev/i2c-1 Current error from Addon trying to access /dev/i2c-1 : PermissionError: [ Errno 1] Operation not permitted '/dev/i2c-1'

frenck commented 1 year ago

This add-on does not support that. If you need such use cases, this add-on is not for you.

../Frenck

njscop commented 1 year ago

@frenck in AppDaemon version 0.11.0 solution was working in 0.12.0 it does not. Would it be possible to add Protection mode toggle - so that those that use it this way have some options accessing RPI i2c which also is running Hassio at the same time?

frenck commented 1 year ago

Protection mode has nothing to do with that. For the rest, see my comment above.

njscop commented 1 year ago

@frenck I really am not trying to be difficult but I'm 99% certain this question will pop up after people start updating the addon to version 0.12.0 .

What is your vision of how this should be done? In my case, I need I2c because the air quality sensor attaches to RPI 4 and comes with Python library. So HA->AD(addon)->Python->Piicodev(library)->I2c access->MQTT(data)->HA(logic).

Everything works now in AppDaemon addon version 0.11.0 ->0.12.0 it does not.

I also understand that this relates to security and is not a trivial thing, I also am open to any direction on how I should "redo" my solution so that in the future it "should" continue working.

frenck commented 1 year ago

What is your vision of how this should be done?

Sorry, but that is pretty simple, don’t use the addon.

For such cases, I would strongly recommend running AppDeamon (or any other application) natively, in this case, directly in Python.