seaky / nspanel_pro_tools_apk

279 stars 4 forks source link

Request to adapt S6E (relay) #95

Open maodun96 opened 1 month ago

maodun96 commented 1 month ago

Hello, developer. I have an S6E device and I really enjoy the programs you've developed, and I'm looking forward to future updates. As an S6E user, I would like to request a new feature. The S6E has two relays, and the way to switch them is by writing 0 or 1 to sys/class/gpio/gpio114 (or gpio115)/value. Would it be possible to implement the use of these relays in the form of a floating window?

The only difference between the S6E and T6E is the relays. So I'm really hoping you can help me with this.

thanks!

Reference links:https://github.com/Astogems/Home-Assistant-S6E-Tuya-Smart-Panel-Relay-Controls

seaky commented 1 month ago

Hi,

What does mean "floating window" ?

regards

maodun96 commented 1 month ago

Hi,

What does mean "floating window" ?

regards

floating button,When using the translator, I introduced Chinese usage habits... Back on topic, maybe use a floating button to open a menu to control the relay. When I tried using macrodroid just now, I found that it can add a sidebar to the system. When you slide to open the sidebar, you can run some macros. You can also set some applications to open. Maybe this is also a very good choice.

maodun96 commented 1 month ago

Hello, @seaky

I recently tried SoftCircle, which can place widgets created by Automagic on a floating button. By long pressing, the widgets can be called out, as shown in the image. This almost meets my needs, except that it's quite ugly. image

If possible, I sincerely hope that similar functionality can be integrated into your application. I hope you can consider it. Thank you!

attached the Relay_State script I made with Automagic and the relay switching script modified from the previous link.

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>

true File Observer: /sys/class/gpio/gpio114/value on events Modify true /sys/class/gpio/gpio114/value false false false false false false false true false false false false true Execute Root Command: cat value in /sys/class/gpio/gpio114 cat value /sys/class/gpio/gpio114 300000 stdout stderr exit_code true Script: if (stdout == "1") { global_relay1_state = "on"; } else { global_relay1_state = "off"; } Relay State 1 true PARALLEL Script: if (stdout == "1") { global_relay1_state = "on"; } else { global_relay1_state = "off"; } Execute Root Command: cat value in /sys/class/gpio/gpio114 File Observer: /sys/class/gpio/gpio114/value on events Modify

<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>

true HTTP Request: /relay1, port 8080 true /relay1 8080 false true false true Execute Root Command: echo $(( $(cat /sys/class/gpio/gpio114/value) ^ 1 )) > /sys/class/gpio/gpio114/value in echo $(( $(cat /sys/class/gpio/gpio114/value) ^ 1 )) > /sys/class/gpio/gpio114/value 300000 stdout stderr exit_code Relay 1 toggle true PARALLEL HTTP Request: /relay1, port 8080 Execute Root Command: echo $(( $(cat /sys/class/gpio/gpio114/value) ^ 1 )) > /sys/class/gpio/gpio114/value in
maodun96 commented 1 month ago

I noticed in past issue that you mentioned support for GPIO would be added in version 2.2.0. This fulfills my need to use HA to control relays. In comparison, the need to operate switches locally on the device is not as important. Because this would only be used in certain emergency situations.

Thank you for the development.

seaky commented 1 month ago

the mqtt based switch will be available at 2.2.0 soon

maodun96 commented 1 month ago

the mqtt based switch will be available at 2.2.0 soon

Thank you very much for your development.

maodun96 commented 1 week ago

@seaky Hello, thank you for supporting this feature. At present, after controlling switch1 and 2 on the device, the status in HA will not change. Can I ask you to support the relevant status feedback? By the way, I replied to your g email.

regards

seaky commented 1 week ago

I leave it open, I’m working on it.