mitch7391 / homebridge-cmd4-AdvantageAir

Catered shell script to integrate air conditioner control units by Advantage Air into HomeKit using the plug-in homebridge-cmd4.
MIT License
38 stars 5 forks source link

[Bug]AdvAir.sh cannot write to /tmp #58

Closed CharlotteWlkr86 closed 2 years ago

CharlotteWlkr86 commented 2 years ago

Paste of Logs:

The problem is that AdvAir.sh writes to /tmp directly which gives permission denied.
Linux on the Sony is via termux, like a docker image where temporary files are only accessible through
the proper call to mktemp. For instance:
mktemp --suffix=myFile
/data/data.com.termux/files/usr/tmp/41Iun75mtymyFile
As such, AdvAir.sh incorrectly creates temporary files.

Cmd4 Config:

Screenshots:

Advantage Air System: Not applicable at this time

Homebridge Environment:

ztalbot2000 commented 2 years ago

Hi,

Can you please try from within termux to see if the global environmental variable TMPDIR is available by echo $TMPDIR The reason I ask is that some distros handle mktemp differently. Some have the prefix as you have shown, some use a different template style. Congrats on getting Homebridge running on an Android TV. I do not know if I would be so brave :-)

Thanks, John Talbot

On Mon, May 2, 2022 at 11:37 PM CharlotteWlkr86 @.***> wrote:

Paste of Logs:

The problem is that AdvAir.sh writes to /tmp directly which gives permission denied. Linux on the Sony is via termux, like a docker image where temporary files are only accessible through the proper call to mktemp. For instance: mktemp --suffix=myFile /data/data.com.termux/files/usr/tmp/41Iun75mtymyFile As such, AdvAir.sh incorrectly creates temporary files.

Cmd4 Config:

Screenshots:

Advantage Air System: Not applicable at this time

  • Control Unit: e-zone / MyAir / MyAir3 / MyAir4 / MyPlace / zone10e / zone10 - Not applicable at this time
  • Temperature Sensors: Yes / No

Homebridge Environment:

  • Node.js Version: Node.js is v16.3.1.
  • NPM Version: 8.8.0
  • Homebridge Version: Homebridge v1.4. 1 (HAP vO.10.2) (Homebridge)
  • homebridge-cmd4 Version: 6.3.0
  • homebridge-cmd4-AdvantageAir Version: 3.3.0
  • Operating System: Raspbian / Ubuntu / Debian / Windows / macOS / Docker / other Sony KD43X8000H Android TV. The OSTYPE linux-eabI via termux

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/58, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX6QMXUEJYPRKMB7KYTVICNOFANCNFSM5U5XWTJQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

CharlotteWlkr86 commented 2 years ago

Thanks for the quick response John. I checked termux echo $TMPDIR /data/data/com, termux/files/usr/tmp touch $TMPDIR/itworks This is also an answer,

mitch7391 commented 2 years ago

Thanks for replying to this one in my absence John, I have no experience with termux.

I am also very intrigued by Homebridge running on an Android TV; this project is slowly getting to all sorts of devices!

@CharlotteWlkr86 I was wondering if you might be able to provide a little more information on this issue? Is it just that you cannot access the error logs due to it not being able to write to the folder? Or does this not allow the entire plugin to work? I imagine the latter may be the case as it cannot access some of the constants we are writing there. Just trying to understand the issue a little better.

CharlotteWlkr86 commented 2 years ago

@mitch7391 A learning experience for sure. termux is CML driven. apt installs nodejs and npm installs homebridge. My network devices already are already pinged with CMD4. homebridg in debug mode just gave me AdvAir.sh was failing, so I gave that a go from the termux prompt and found the permission denied errors to /tmp.

ztalbot2000 commented 2 years ago

Hey Mitch,

Both my Sony TV's are newer models than hers. termux is available through the Google Play store. Charlotte's problem made me look it up. Many years ago I got Kodi through the Google Play Store and it was blazingly fast. I never had seen homebridge in the Google Play Store and have learned something new with termux.

Ttyl, John

On Wed, May 4, 2022 at 2:05 AM CharlotteWlkr86 @.***> wrote:

@mitch7391 https://github.com/mitch7391 A learning experience for sure. termux is CML driven. apt installs nodejs and npm installs homebridge. My network devices already are already pinged with CMD4. homebridg in debug mode just gave me AdvAir.sh was failing, so I gave that a go from the termux prompt and found the permission denied errors to /tmp.

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/58#issuecomment-1116957545, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCXYWEQEQWZ4JGQPBEX3VIIHQ5ANCNFSM5U5XWTJQ . You are receiving this because you commented.Message ID: @.***>

mitch7391 commented 2 years ago

homebridg in debug mode just gave me AdvAir.sh was failing, so I gave that a go from the termux prompt and found the permission denied errors to /tmp.

Awesome, this is a good find thank you @CharlotteWlkr86! John has emailed me a potential solution to this for us to add and test in the next beta. I will leave this issue open until then.

ztalbot2000 commented 2 years ago

Hi Charlotte,

Sorry for the delay. We would like to know what kind of device $TMPDIR is on. Is it RAM or Flash. Can you please run the following command and send us the results.

df $TMPDIR

thanks, John Talbot

On Wed, May 4, 2022 at 9:16 PM Mitch Williams @.***> wrote:

homebridg in debug mode just gave me AdvAir.sh was failing, so I gave that a go from the termux prompt and found the permission denied errors to /tmp.

Awesome, this is a good find thank you @CharlotteWlkr86 https://github.com/CharlotteWlkr86! John has emailed me a potential solution to this for us to add and test in the next beta. I will leave this issue open until then.

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/58#issuecomment-1118076192, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSBCX5WGA6YN2MESFIXNX3VIMOOFANCNFSM5U5XWTJQ . You are receiving this because you commented.Message ID: @.***>

CharlotteWlkr86 commented 2 years ago

Heeryago

$ df $TMPDIR Filesystem: /dev/block/mmcblk0p45 1k-blocks: 8564184 Used: 5763904 Available: 2342196 Use%: 72% Mounted on: /data

Toodles

On Tue, May 3, 2022 at 11:25 AM John Talbot @.***> wrote:

Hi,

Can you please try from within termux to see if the global environmental variable TMPDIR is available by echo $TMPDIR The reason I ask is that some distros handle mktemp differently. Some have the prefix as you have shown, some use a different template style. Congrats on getting Homebridge running on an Android TV. I do not know if I would be so brave :-)

Thanks, John Talbot

On Mon, May 2, 2022 at 11:37 PM CharlotteWlkr86 @.***> wrote:

Paste of Logs:

The problem is that AdvAir.sh writes to /tmp directly which gives permission denied. Linux on the Sony is via termux, like a docker image where temporary files are only accessible through the proper call to mktemp. For instance: mktemp --suffix=myFile /data/data.com.termux/files/usr/tmp/41Iun75mtymyFile As such, AdvAir.sh incorrectly creates temporary files.

Cmd4 Config:

Screenshots:

Advantage Air System: Not applicable at this time

  • Control Unit: e-zone / MyAir / MyAir3 / MyAir4 / MyPlace / zone10e / zone10 - Not applicable at this time
  • Temperature Sensors: Yes / No

Homebridge Environment:

  • Node.js Version: Node.js is v16.3.1.
  • NPM Version: 8.8.0
  • Homebridge Version: Homebridge v1.4. 1 (HAP vO.10.2) (Homebridge)
  • homebridge-cmd4 Version: 6.3.0
  • homebridge-cmd4-AdvantageAir Version: 3.3.0
  • Operating System: Raspbian / Ubuntu / Debian / Windows / macOS / Docker / other Sony KD43X8000H Android TV. The OSTYPE linux-eabI via termux

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/58, or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABSBCX6QMXUEJYPRKMB7KYTVICNOFANCNFSM5U5XWTJQ

. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/mitch7391/homebridge-cmd4-AdvantageAir/issues/58#issuecomment-1116229775, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY7UN7UBPJPWUASNNGEWA3TVIFAO3ANCNFSM5U5XWTJQ . You are receiving this because you authored the thread.Message ID: @.***>

mitch7391 commented 1 year ago

Hey @CharlotteWlkr86 just curious to know if v3.4.0 had resolved your issue?