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
96 stars 44 forks source link

NeoPixel and nightlight #14

Open tiagombrito opened 1 year ago

tiagombrito commented 1 year ago

Hello,

I'm wondering if what i'm observing is the intended behaviour of the wall switch.

When I turn the NeoPixel light on and then push one of the touchfields, the light is turned off. In home assistant the entity is still shown as on. I've seen this happening in 3 different devices, with 1 and 2 channels

When i do the same thing with the nightlight, the light doesn't turn off, but it dims and returns to full brightness 2 seconds later.

I'm thinking this may happen because of the light effects on touch, multi touch, etc. that are overriding the neopixel light. I made all effect brightnesses 0 so as to not have any effects, is there any more appropriate way to do have no effects?

Thank you.

danielscheidler commented 1 year ago

Thanks for the feedback. I'll take a look at the effects and brightness again. To have no effects you can set them to "None" I think.

barth11 commented 5 months ago

I have a similar problem. I don't use nightlight but I created an automation which on multitouch enables Pulse effect which I have to repeat after multitouch effect is done...now I have it set to repeat after 3 seconds. When I don't do it the Neopixel is still on but LEDs are off and only the status LEDs are pulsing 😁 See here: https://streamable.com/22ah2w

This automation with the delay is a workaround to this problem because it enables the Pulse after the multitouch effect is done effecting... Delay could be as the first step but I wanted the LEDs to react immediately so that's why it's like that.

alias: Enable/Disable LED TX1
description: ""
trigger:
  - type: turned_off
    platform: device
    device_id: 4630bde13982e46e50fe7b6aff640287
    entity_id: ed83d39e9d3ecaf2ab120894e5cb1724
    domain: binary_sensor
action:
  - choose:
      - conditions:
          - condition: state
            entity_id: light.txultimate2_neopixel_light
            state: "on"
        sequence:
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.txultimate2_neopixel_light
      - conditions:
          - condition: state
            entity_id: light.txultimate2_neopixel_light
            state: "off"
        sequence:
          - service: light.turn_on
            target:
              entity_id: light.txultimate2_neopixel_light
            data:
              rgb_color:
                - 236
                - 55
                - 168
              brightness: 254
              effect: Pulse
          - delay:
              hours: 0
              minutes: 0
              seconds: 3
              milliseconds: 0
          - service: light.turn_on
            target:
              entity_id: light.txultimate2_neopixel_light
            data:
              rgb_color:
                - 236
                - 55
                - 168
              brightness: 255
              effect: Pulse

Interestingly this workaround doesn't work for Neopixel effect "None". As far as I tested it for now. EDIT: For None I went with 10s and it works...

barth11 commented 5 months ago

I just did some more testing and I don't know if it was the version or my setup but ignoring my comment above a trying it on another device the NeoPixel light gets overridden by the effect of pressing any button or multitouch. It's really bad that the light effect override user setup.

Zedread commented 4 months ago

There is a "workaround" for this, instead of trying to use the Neopixel entity for displaying your automation, use the Nightlight entity. The "problem" here is that the implementation is prepared to "recover" the nightlight display above all other settings, if you have nightlight on, and a button on at the same time, when you turn off the button the code sets that led partition to display the nightlight definition. I've run into the same problem as you, and tried to modify the code to no luck, but in the end i realized i didn't need it, i just need to change the entity i was using. So if you start using the Nightlight entity instead of the Neopixel you should be able to do what you intended.

barth11 commented 4 months ago

But this will only work with solid colours no? If I choose rainbow or other effect which NeoPixel has, then it'll not work. Or at least I don't see a possibility how to set Nightlight as Rainbow effect.