SmartHome-yourself / sonoff-tx-ultimate-for-esphome

ESPHome Custom Component for Sonoff TX Ultimate
https://smarthomeyourself.de/sonoff-tx-ultimate-mit-esphome-custom-component/
MIT License
102 stars 45 forks source link

TX - ULTIMATE - T5-3C-120 LED BEHAVIOUR [SOLVED] #45

Open Zagor4 opened 4 months ago

Zagor4 commented 4 months ago

Good morning everyone,

I tried to adapt the code for the model in question as follows:

When the right, center, and left buttons are pressed, 2 LEDs above and 2 LEDs below each button light up. The LED effects related to Swipe Left, Swipe Right, Multitouch, and Long Press are executed randomly around the entire perimeter of the device. The NightLight should light up around the entire perimeter (excluding the LEDs reserved for the buttons), but here is the problem I would like to discuss with you. Furthermore, the NightLight is no longer managed by the internal script of the Firmware but is exposed on HA only as a switch for automations directly manageable by HA with possible presence, brightness sensors, etc.

The problem is that some LEDs, besides those reserved for the buttons, do not light up for the NightLight, leaving an incomplete illuminated perimeter. Could someone help me out? I am attaching my code and an image of the problem with the NightLight.

Thanks in advance. Sonoff - TX 120 - GitHub.txt IMG_20240623_223923

Zagor4 commented 4 months ago

The code that i'm using... Sonoff - TX 120 - GitHub_2.txt

MantasGSXR commented 3 months ago

The code that i'm using... Sonoff - TX 120 - GitHub_2.txt

Bro! Thank you so much for this! I have been struggling for hours to make those damned LEDs work properly! You are the man!

Zagor4 commented 3 months ago

Hello! I'm happy that the code helps you.

I also added a new feuture that permit to change nightlight color. (is possible to change the color pressing a zigbee botton or an other home assistant entity). If you are interested i can post the new code. 👍

MantasGSXR commented 3 months ago

That sounds like a much needed feature! Please do share your code. I really appreciate it.

Zagor4 commented 3 months ago

Read the TXT ! :) ChangeColour.txt

MantasGSXR commented 3 months ago

Read the TXT ! :) ChangeColour.txt

Hey! This is really awesome! I love it! Thank you very much for sharing and great job!

mon3y78 commented 2 months ago

@Zagor4 Can you help me fix my version for the 4 gang? I find your version very nice, functional, and it meets my needs. I don't understand the part of the code between lines 595 and 640. With the changes I made, the LED management works partially when I turn on the buttons. https://github.com/mon3y78/4gangus/blob/main/4gangus.yaml

Zagor4 commented 2 months ago

Good Morning! Now i'm on holiday without a PC. At the end of August i will be at home and i will check your code hoping that i can help you.

Il gio 15 ago 2024, 08:15 mon3y78 @.***> ha scritto:

@Zagor4 https://github.com/Zagor4 Can you help me fix my version for the 4 gang? I find your version very nice, functional, and it meets my needs. I don't understand the part of the code between lines 595 and 640. With the changes I made, the LED management works partially when I turn on the buttons. https://github.com/mon3y78/4gangus/blob/main/4gangus.yaml

— Reply to this email directly, view it on GitHub https://github.com/SmartHome-yourself/sonoff-tx-ultimate-for-esphome/issues/45#issuecomment-2290740530, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUAZFLT4FZXTVBTK7NVWOBTZRRBQVAVCNFSM6AAAAABKKISF3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJQG42DANJTGA . You are receiving this because you were mentioned.Message ID: <SmartHome-yourself/sonoff-tx-ultimate-for-esphome/issues/45/2290740530@ github.com>

fjordaan00711 commented 2 months ago

@Zagor4 the code work like a charm :-)

Thanks

Zagor4 commented 2 months ago

@Zagor4 Can you help me fix my version for the 4 gang? I find your version very nice, functional, and it meets my needs. I don't understand the part of the code between lines 595 and 640. With the changes I made, the LED management works partially when I turn on the buttons. https://github.com/mon3y78/4gangus/blob/main/4gangus.yaml

Good Evening, Could you post a board photo or image where is possible to see the LEDS numbers ? If you will post the photo, i will try to adapt my code for the 4 gangs version !

Thanks Have a nice evening. Z.

Zagor4 commented 2 months ago

@Zagor4 the code work like a charm :-)

Thanks

I'm realy happy about this ! :) Thanks Z.

mon3y78 commented 2 months ago

Hi, welcome back from vacation! During this time, I tried working with the code. I managed to make some progress! Now the button lighting is improving, as you can see in the photos. I still don’t understand how to solve the neopixel lighting issue, but I think that might be a problem with the base code of SmartHome yourself. The left side doesn’t light up.

My code: https://github.com/mon3y78/4gangus/blob/5df818099256984fbab48adae76c6c9ac3c03a49/4gangus.yaml

image image image image image image

Zagor4 commented 2 months ago

Hi, welcome back from vacation! During this time, I tried working with the code. I managed to make some progress! Now the button lighting is improving, as you can see in the photos. I still don’t understand how to solve the neopixel lighting issue, but I think that might be a problem with the base code of SmartHome yourself. The left side doesn’t light up.

My code: https://github.com/mon3y78/4gangus/blob/5df818099256984fbab48adae76c6c9ac3c03a49/4gangus.yaml

Good Evening,

I try to explain the LED partitions behaviour: You have:

Led partition for L1 Led partition for L2 Led partition for L3 Led partition for L4 Led Top Partition (all led without L1, L2, L3, L4 partitions - This is important you can't have same LEDS in LED top and L1, or L2, L3, L4).

When you switch on Nightlight or you active a gesture (Swipe, Long Press, Multi touch) you switch on Led Top Partition. If you switch on L1 (or L2,L3,L4), you switch on LED Partition L1 (or L2, L3, L4) with generic button colour and light intensity, if you switch off L1 (or L2, L3, L4) and Nightlight is ON, the routine change colour and light intensity of L1 (or L2, L3, L4) with colour and light intensity of Nightlight. If you switch off L1 (or L2, L3, L4) and Nightlight is OFF, the routine switch off L1 (or L2, L3, L4).

Could you try this code ? Please let me know if it works correctly or if you have same unexpected behaviour.

Have a nice evening. TX_Ultimate_4Gang.txt

Z.

fjordaan00711 commented 2 months ago

Hi your code is missing LED 10 to 15, is that not the LEDS that does not lightup?

Fj

On Tue, 3 Sept 2024 at 00:05, Zagor4 @.***> wrote:

Hi, welcome back from vacation! During this time, I tried working with the code. I managed to make some progress! Now the button lighting is improving, as you can see in the photos. I still don’t understand how to solve the neopixel lighting issue, but I think that might be a problem with the base code of SmartHome yourself. The left side doesn’t light up.

My code: https://github.com/mon3y78/4gangus/blob/5df818099256984fbab48adae76c6c9ac3c03a49/4gangus.yaml

Good Evening, Could you try this code ? Please let me know if it works correctly or if you have same unexpected behaviour.

Have a nice evening. TX_Ultimate_4Gang.txt https://github.com/user-attachments/files/16841449/TX_Ultimate_4Gang.txt

Z.

— Reply to this email directly, view it on GitHub https://github.com/SmartHome-yourself/sonoff-tx-ultimate-for-esphome/issues/45#issuecomment-2325334906, or unsubscribe https://github.com/notifications/unsubscribe-auth/AL6LHJZVOGDVJBYUMCEXJN3ZUTOJDAVCNFSM6AAAAABKKISF3CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRVGMZTIOJQGY . You are receiving this because you commented.Message ID: <SmartHome-yourself/sonoff-tx-ultimate-for-esphome/issues/45/2325334906@ github.com>

mon3y78 commented 2 months ago

@Zagor4 now the led of l1 and l4 don't work image

mon3y78 commented 2 months ago

@fjordaan00711 Can you explain better? Where was it forgotten?

Zagor4 commented 2 months ago

@Zagor4 now the led of l1 and l4 don't work !

Colud you try this new code ? TX_Ultimate_4Gang_V2.txt

mon3y78 commented 2 months ago

Now, as you can see, the LED partitioning for the buttons is working correctly! Thank you very much! However, whether I press L4 or activate 'TX Ultimate Cartongesso L4,' the 'LEDs Button L4' does not automatically activate. If I activate 'LEDs Button L4,' it lights up white, but I think it should be blue. IMG_1425

Screenshot 2024-09-03 alle 19 46 50
Zagor4 commented 2 months ago

Good Evening @mon3y78 , Try this new code and please let me know. Please try also to switch on NightLight and after switch on and switch off L1, L2, L3 and L4 and verify if the behaviour will be correct. (nightlight, not NeoPixel Light)

Thanks Have a nice evening Z.

TX_Ultimate_4Gang_V3.txt

mon3y78 commented 2 months ago

Everything seems to be working correctly. Do I need to change any of my settings to synchronize the buttons and devices. In some automations, I was using 'LEDs Button L1' instead of 'TX Ultimate Cartongesso L1' because it gave me the ability to synchronize the color or light intensity. Additionally, in Nightlight mode, the left side does not light up. IMG_1426

Zagor4 commented 2 months ago

@mon3y78 try this code for the NightLight problem... (I only change the order of the LED segments) but i don't understand why the left side don't switch on ! (Did you restart the TX Ultimate, after the firmware installation ? )

Could you please paste an example of automation ? I've linked, in my automations, the lights with TX Ultimate switches entities...

TX_Ultimate_4Gang_V4.txt

mon3y78 commented 2 months ago

I tried the new code. The only new anomaly I noticed is that when I press L1 to turn it on, I don’t get a brief movement of the LEDs like I do with the other buttons. I use ‘https://github.com/alexdelprete/ha-blueprints’ for the synchronization of the tx buttons and devices. I find it very convenient, fast and functional. Thank you! Wishing you a great day as well!

mon3y78 commented 2 months ago

@Zagor4

I discovered that the issue with the LEDs when I press the button is related to the left part of the TX. In fact, when it doesn’t happen there, everything works! Have you had any ideas on how to solve this or what might be causing the problem? Did you try the blueprint? What do you think?

Zagor4 commented 1 month ago

@mon3y78 I'm sorry, but at the moment I have a lot of work and don't have much time to analyze the code. Currently, I have no idea why the left side of the LEDs isn't turning on in the nightlight configuration. It's difficult to understand the behavior because I don't have a 4-gang device on hand.

I used the blueprint but a had some syncronisation problem so i wrote my automation:

mon3y78 commented 1 month ago

I’m happy to hear from you! I was starting to worry! As soon as I can, I’ll try your automation. When you have time, I recommend this discussion: https://community.home-assistant.io/t/sonoff-tx-ultimate-and-voice-assistant/682214?u=ipilla. Hope to hear from you soon!

Zagor4 commented 1 month ago

I’m happy to hear from you! I was starting to worry! As soon as I can, I’ll try your automation. When you have time, I recommend this discussion: https://community.home-assistant.io/t/sonoff-tx-ultimate-and-voice-assistant/682214?u=ipilla. Hope to hear from you soon!

I've read the code of the discussion you linked... It's impressive! I don't have the expertise to understand the configurations, scripts, and automations without studying. He used a completely different approach to address the LEDs and also to manage the touch! It's a realy cool project !