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

Anyone with a US 3 Gang configuration which works ? #29

Open burghs opened 9 months ago

burghs commented 9 months ago

Hi there,

Is there perhaps anyone who has a working yaml config for the US 3 gang version of the Sonoff TX Ultimate which they can share ?

WallSecurity commented 9 months ago

Hi @burghs,

This is my config. I think its pretty much the normal config by SHYS with some minor changes (lights and exposed audio amplifier, mostly). The touch config is the same as the EU version, might not be ideal but it works.

Let us know, if you find something better!

sonoff-txu-1.txt

burghs commented 9 months ago

Hi @burghs,

This is my config. I think its pretty much the normal config by SHYS with some minor changes (lights and exposed audio amplifier, mostly). The touch config is the same as the EU version, might not be ideal but it works.

Let us know, if you find something better!

sonoff-txu-1.txt

thank you for this. I will give it a try.

TommySharpNZ commented 8 months ago

Thanks for example @WallSecurity I notice your version doesn't do anything like turn on the LEDs when a relay is turned on... Or support the multitouch etc... Unless I have done something wrong?

WallSecurity commented 8 months ago

Hi @TommySharpNZ,

My version does support multitouch. Look for "on_full_touch_release" in the code. It's the same as in SHYS implementation.

My implementation does indeed not turn the lights on, that is correct. All lights (left, right, bottom, top and top_left_right, middle_left_right, bottom_left_right for the respective touch zones) are exposed to the HA frontend. My leds are controlled via automations. This does have downsides (e.g. won't work when disconnected), but I like the advantages (which might be possible in ESPHome, idk).

Ultimately, I like changing stuff around, especially globally for all my switches, without having to edit every switch config and reflash all devices.

Please notice, in my version the touchfield_1 is not actually switching the switch, because it is used as a two-way switch. I forgot to mention that. Change this , if you need it to switch.

  - platform: template
    name: "Touchfield 1"
    id: touchfield_1
    on_press:
+     - switch.toggle: relay_1
      - binary_sensor.template.publish:
          id: touchfield_1
          state: OFF
ady1972 commented 7 months ago

hi @WallSecurity

i'm making some trying on your yaml that i find very interesting. I have only a question for you : I found very very interesting possibilty to expose light partiotn as switch in home assistant , because this means that they can be used also for interesting automation of pure "light ambient" :). How did you do this? I compare your yaml with smarthome-yourself one but i'm not able to find the difference.

Thanks a lot in advance

Ciao

WallSecurity commented 7 months ago

hi @ady1972,

I am not sure, if I understand your question correctly. Can you please clarify which part of the yaml causes the question? Are you encountering problems exposing the lights to the home assistant front end or do you need help writing automations to control the lights?

ady1972 commented 7 months ago

Using your yaml , entities below could be switch direcly on entity page under ESP integratio. This does not happen with original yaml file.

My question is : How did you do to male this light compare with switch?

Senza titolo

WallSecurity commented 7 months ago

Hi @ady1972,

Remove the following line from SHYS code:

  - platform: partition
    name: "LEDs Button right"
    id: leds_button_right
-    internal: true
    segments:
      - id: leds
        from: 7
        to: 7

This exposes it to the frontend.

ady1972 commented 7 months ago

Many thanks @WallSecurity ... It will be very usefull for my automations. :)

Thanks a lot

Zagor4 commented 4 months ago

Hello everyone, In attach you can find my code modified for T5-3C-120. But i have a problem with LEDS of the NightLight partition. I'm not able to switch on all the leds in nightlight mode ( excluding the LEDs reserved for the buttons ). I've opened an issue in this GitHub. Please let me know what do you think about this, and if you can help me with my issue... Thanks a lot Sonoff - TX 120 - GitHub.txt

Wallexus commented 4 months ago

Hi @Zagor4,

change your segments ids from id: leds_top to id: leds in your nightlight setup so it looks like this:

  - platform: partition
    name: "LEDs Nightlight"
    id: leds_nightlight
    internal: true
    segments:
-      - id: leds_top
+      - id: leds
        from: 2
        to: 2
        [...]

Please do not ask for help in multiple channels.

Zagor4 commented 4 months ago

@Wallexus thanks a lot for your answer, I've already tried to change "LEDS_Top" with LEDS for all segments of the led partition NightLight.

But this solution doesn't work because i have an unexpected behaviour: when i switch on the nightlight, only leds reserved for buttons (2 leds in superior part and 2 leds under each button accordingly my code for buttons) are switched on in the color and brightness of nightlight... and i have flickering on left and righe side of the device when i push buttons but in idle left and right side are switched off... :(

Could be nececcery to change somthing in the scripts that change the LED state ? thanks a lot !

WallSecurity commented 4 months ago

Hi @Zagor4, Unfortunately I don't have the time right now to debug a script this big right now. But here are some things, that might help you along your journey.

  1. set your nightlight leds internal: true to false. This exposes them to your homeassistants device frontend and allows you to switch your nightlight LEDs on and off by using homeassistants light entity. Test this with a color of your choice to see, whether you are addressing the right leds. If you are, there is probably a bug in one of your scripts
  2. you have set your nightlight templates to be optimistic. Check your other automations, if any of them interfere with your esphome scripts or templates.
  3. your refresh_led_default script turns off the leds_top unconditionally (which are the same leds your nightlight uses), so any call to refresh your leds switches your nightlights off and on. Might be unintended. Also, this probably created some very weird behaviour when setting your nightlights to the leds_top id.
Zagor4 commented 4 months ago

@Wallexus Thanks a lot for your answer. I found some problems in the script and in the Nightlight LED partition. I solved all the problems I had for my use.

So if someone needs a code for the 3-gang 120 TX series, I am attaching it! If anyone wants to try my version of the code, please let me know what you think. Thanks.

Consider that the nightligt is not only an internal configuration so it is exposed to HA. If you want use Nightligt, you have to create an automation that switch on or switch off the nightlight with the trigger that you prefer. (i removed the part of the ESPHome firmware that switch on or off the lightnight when the sun is rised o set).

Have a nice WE. Sonoff - TX 120 - GitHub_2.txt