Giter Site home page Giter Site logo

Comments (30)

danielscheidler avatar danielscheidler commented on July 17, 2024

I don't think that it can work as a real siren.
At least I don't know of anything to get the audio output significantly louder. I can test it with an unflashed one, but I suspect that these will not be louder either.

from sonoff-tx-ultimate-for-esphome.

tiagombrito avatar tiagombrito commented on July 17, 2024

Hi Daniel,

This is the youtube video I was refering to from Sonoff's channel, I just hope they didn't remove this from the specs, it'd be a cool feature to have.

Thank you very much for your reply.

from sonoff-tx-ultimate-for-esphome.

chrisrock1984 avatar chrisrock1984 commented on July 17, 2024

I have the same issue - sound is cristal clear but way too low ;-/
Tested it on 2 devices

from sonoff-tx-ultimate-for-esphome.

tiagombrito avatar tiagombrito commented on July 17, 2024

I bought some more wall switches, and i can't find any option in ewelink to make volume higher.
So maybe this is a feature they discarded, and that video is not correct anymore.

from sonoff-tx-ultimate-for-esphome.

loadedlouie avatar loadedlouie commented on July 17, 2024

Hi , i tryed the sound from the switch, but although it works, it adds some "rain" to the sound itself, a bit, white noise if you can say that.. Also using for example google TTS it also adds that white noise sound ... is there any way to fix this ?
Also great job doing this, I also add some other light effects to it, and I love it... thanks in advance for your time dedication and effort to create this for esphome/home assistant.

from sonoff-tx-ultimate-for-esphome.

loadedlouie avatar loadedlouie commented on July 17, 2024

Hi , i tryed the sound from the switch, but although it works, it adds some "rain" to the sound itself, a bit, white noise if you can say that.. Also using for example google TTS it also adds that white noise sound ... is there any way to fix this ? Also great job doing this, I also add some other light effects to it, and I love it... thanks in advance for your time dedication and effort to create this for esphome/home assistant.

In case anyone is wondering... i2s_comm_fmt: lsb (found it on another thread BLE proxy) solves the rain but keep the sound low.. :D

from sonoff-tx-ultimate-for-esphome.

TeDeVPrime avatar TeDeVPrime commented on July 17, 2024

yeah the speaker is VERY low. with the official firmware the sound is excellent. you can play doorbell sounds and it is just fine. in this case through ESP, you can barely hear it

from sonoff-tx-ultimate-for-esphome.

danielscheidler avatar danielscheidler commented on July 17, 2024

In case anyone is wondering... i2s_comm_fmt: lsb (found it on another thread BLE proxy) solves the rain but keep the sound low.. :D

Yes, the i2s_comm_fmt
is already updated in my variants too (did I miss one?). But I've no idea how to get it louder.

from sonoff-tx-ultimate-for-esphome.

TeDeVPrime avatar TeDeVPrime commented on July 17, 2024

i am not even sure if it is louder in the tasmota. the sound is like 10% of the volume even though Home Assistant says 100%

from sonoff-tx-ultimate-for-esphome.

conrad784 avatar conrad784 commented on July 17, 2024

I today flashed esphome without ever using it with ewelink and I am very happy about this project here.
Initially I did not think about using the speakers, but it would be nice to have. So I hope what was said here is true that the original firmware does something differently.

yeah the speaker is VERY low. with the official firmware the sound is excellent. you can play doorbell sounds and it is just fine. in this case through ESP, you can barely hear it

May I ask how you found out which of the GPIOs are doing what @danielscheidler ? Maybe there is some pin which only has to be pulled high/low to enable some amplification?

from sonoff-tx-ultimate-for-esphome.

letsautomatenet avatar letsautomatenet commented on July 17, 2024

So is the sound supposed to be working but just quiet at the moment?

When I try TTS from Home Assistant to it I just get very quiet static noise. No words are spoken. (The yaml has "i2s_comm_fmt: lsb" in it)

(Great work btw @danielscheidler. I was using a really old hand cracked yaml for this switch. This is much nicer)

from sonoff-tx-ultimate-for-esphome.

barth11 avatar barth11 commented on July 17, 2024

@letsautomatenet - The speaker is working flawlessly. I can put there mp3 song you can understand words. It's not loud or very good but that's not something I'd expect from something so small. For ringtone, notifications, doorbell it's enough.

from sonoff-tx-ultimate-for-esphome.

Whatsek avatar Whatsek commented on July 17, 2024

@letsautomatenet - The speaker is working flawlessly. I can put there mp3 song you can understand words. It's not loud or very good but that's not something I'd expect from something so small. For ringtone, notifications, doorbell it's enough.

I want to use it as a doorbell, but the volume on my device is very low. If In play a mp3, I can nearly hear it when my ear is 20cm from the device. Could you share your config?

from sonoff-tx-ultimate-for-esphome.

letsautomatenet avatar letsautomatenet commented on July 17, 2024

@letsautomatenet - The speaker is working flawlessly. I can put there mp3 song you can understand words. It's not loud or very good but that's not something I'd expect from something so small. For ringtone, notifications, doorbell it's enough.

Is there anything special you did? The audio section is as follows, as per the file tx_ultimate_local.yaml:

media_player:
  - platform: i2s_audio
    id: media_out
    name: ${friendly_name} Player
    dac_type: external
    i2s_dout_pin: ${audio_sdata_pin}
    i2s_audio_id: audio_i2s
    i2s_comm_fmt: lsb    
    mode: mono

The documentation here also says it doesn't work at moment so would be good to know how you got it working!

https://github.com/SmartHome-yourself/sonoff-tx-ultimate-for-esphome#media-player

Thanks.

from sonoff-tx-ultimate-for-esphome.

barth11 avatar barth11 commented on July 17, 2024

Is there anything special you did?

@letsautomatenet - I didn't change anything. I just used the setup from this repo and played mp3 from HA.

image

@Whatsek - I can hear the sound from another room but it's not loud but for me it was enough as it's not my primary speaker for ringbell. I didn't change anything.

from sonoff-tx-ultimate-for-esphome.

letsautomatenet avatar letsautomatenet commented on July 17, 2024

Thanks for the reply.

No idea why mine isn't working. :-( It just goes straight to "Idle" when I try TTS or MP3.

from sonoff-tx-ultimate-for-esphome.

letsautomatenet avatar letsautomatenet commented on July 17, 2024

I finally got it to work! Here were my issues in case someone else has similar:

  • The URL presented by Home Assistant is my https external URL, as this is what is required for TTS with Google Home. This was not resolving/being blocked by my firewall for my ESP device. I assigned the ESP device a DNS address of my local AdGuard DNS server with a local rewrite rule to the HA ip address to prevent any potential DNS loopback/hairpin issues

  • Some of my MP3s simply don't play on it. So when I thought I hadn't resolved the comms issue, I in fact had. Perhaps it's the encoding of these MP3s it doesn't like. The same files play on the Google speakers.

It is indeed pretty quiet.

from sonoff-tx-ultimate-for-esphome.

Whatsek avatar Whatsek commented on July 17, 2024

I will test some MP3`s tonight, @letsautomatenet pretty quiet, can you hear it from 3 meters away? (I cant)

from sonoff-tx-ultimate-for-esphome.

knuppe avatar knuppe commented on July 17, 2024

Same problem here, I can't hear the device from 3 meters away.

I was thinking about exploring the original firmware and see if we find something for it, does anyone have its original .bin file?

from sonoff-tx-ultimate-for-esphome.

Nalith avatar Nalith commented on July 17, 2024

Same problem here, I can't hear the device from 3 meters away.

I was thinking about exploring the original firmware and see if we find something for it, does anyone have its original .bin file?

I have the US version firmware for 2G and 3G.

from sonoff-tx-ultimate-for-esphome.

robbiedehand avatar robbiedehand commented on July 17, 2024

for me the sound is not hearable, if i put my ear against is i hear some static and when i play media that static is changing in tone for a short while, anybody got suggestions?

for now i connected out the audio component and will install, see if the static is gone

from sonoff-tx-ultimate-for-esphome.

robbiedehand avatar robbiedehand commented on July 17, 2024

Okay can sombody give me a pointer on how to disable the static :-) now that i have heard it, i cant unhear it.

i hav comented out

# audio_lrclk_pin: GPIO4
# audio_bclk_pin: GPIO2
# audio_sdata_pin: GPIO15

#media_player:
#  - platform: i2s_audio
#    id: media_out
#    name: ${friendly_name} Player
#    dac_type: external
#    i2s_dout_pin: ${audio_sdata_pin}
#    i2s_audio_id: audio_i2s
#    i2s_comm_fmt: lsb    
#    mode: mono

#i2s_audio:
#  id: audio_i2s
#  i2s_lrclk_pin: ${audio_lrclk_pin}
#  i2s_bclk_pin: ${audio_bclk_pin}

full config:

substitutions:
  name: "tx-badkamer"
  friendly_name: "tx-badkamer"

  relay_count: "2"

  toggle_relay_1_on_touch: "false"
  toggle_relay_2_on_touch: "false"
  toggle_relay_3_on_touch: "false"

  vibra_time: 150ms
  button_on_time: 500ms

  button_brightness: "0.7"
  button_color: "{0,0,100}"

  nightlight: "off"
  nightlight_brightness: "0.2"
  nightlight_color: "{80,70,0}"

  latitude: ""
  longitude: ""

  touch_brightness: "1"
  touch_color: "{0,100,100}"
  touch_effect: "Scan"

  long_press_brightness: "1"
  long_press_color: "{100,0,0}"
  long_press_effect: ""

  multi_touch_brightness: "1"
  multi_touch_color: "{0,0,0}"
  multi_touch_effect: "Rainbow"

  swipe_left_brightness: "1"
  swipe_left_color: "{0,100,0}"
  swipe_left_effect: ""

  swipe_right_brightness: "1"
  swipe_right_color: "{100,0,70}"
  swipe_right_effect: ""

  relay_1_pin: GPIO18
  relay_2_pin: GPIO17
  relay_3_pin: GPIO27
  relay_4_pin: GPIO23

  vibra_motor_pin: GPIO21
  pa_power_pin: GPIO26

  led_pin: GPIO13
  status_led_pin: GPIO33

  uart_tx_pin: GPIO19
  uart_rx_pin: GPIO22

 # audio_lrclk_pin: GPIO4
 # audio_bclk_pin: GPIO2
 # audio_sdata_pin: GPIO15

  touchpanel_power_pin: GPIO5

esphome:
  name: ${name}
  friendly_name: ${friendly_name}
  project:
    name: smarthomeyourself.tx_ultimate
    version: "1.0"

  on_boot:
    priority: -100
    then:
      - binary_sensor.template.publish:
          id: touchfield_1
          state: OFF
      - binary_sensor.template.publish:
          id: touchfield_2
          state: OFF
      - binary_sensor.template.publish:
          id: touchfield_3
          state: OFF
      - binary_sensor.template.publish:
          id: multi_touch
          state: OFF
      - binary_sensor.template.publish:
          id: swipe_left
          state: OFF
      - binary_sensor.template.publish:
          id: swipe_right
          state: OFF
      - binary_sensor.template.publish:
          id: long_press
          state: OFF
      - script.execute: refresh_led_default
      - script.execute: refresh_nightlight

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:
#  hardware_uart: UART2
  level: DEBUG
  logs:
    binary_sensor: INFO
    light: INFO
    script: INFO
    switch: INFO
    tx_ultimate_touch: INFO
    uart_debug: INFO

api:
  encryption:
    key: "IKoqOfyATd/7Gclz7fjZR0RIhMly70dlNcVTdTKjaw0="

ota:
  password: "c2fb756863879cb79c571d87a09d178c"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  manual_ip:
    static_ip: 192.168.100.52
    gateway: 192.168.100.1
    subnet: 255.255.255.0
    dns1: 192.168.100.201
    dns2: 192.168.100.202
  ap:
    ssid: ${name}
    password: !secret wifi_ap_password
    
improv_serial:

captive_portal:

external_components:
#  - source: /config/esphome/my_components
  - source:
      type: git
      url: https://github.com/SmartHome-yourself/sonoff-tx-ultimate-for-esphome
      ref: main
    components: [tx_ultimate_touch]



globals:
  - id: nightlight_color
    type: int [3]
    restore_value: no
    initial_value: ${nightlight_color}
  - id: button_color
    type: int [3]
    restore_value: no
    initial_value: ${button_color}
  - id: long_press_color
    type: int [3]
    restore_value: no
    initial_value: ${long_press_color}
  - id: multi_touch_color
    type: int [3]
    restore_value: no
    initial_value: ${multi_touch_color}
  - id: swipe_left_color
    type: int [3]
    restore_value: no
    initial_value: ${swipe_left_color}
  - id: swipe_right_color
    type: int [3]
    restore_value: no
    initial_value: ${swipe_right_color}
  - id: touch_color
    type: int [3]
    restore_value: no
    initial_value: ${touch_color}    



binary_sensor:
  - platform: template
    name: "Touchfield 1"
    id: touchfield_1
    on_press:
      - if:
          condition:
            lambda: "return ${toggle_relay_1_on_touch};"
          then:
            - switch.toggle: relay_1
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: touchfield_1
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Touchfield 2"
    id: touchfield_2
    on_press:
      - if:
          condition:
            lambda: "return ${toggle_relay_2_on_touch};"
          then:
            - switch.toggle: relay_2
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: touchfield_2
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Touchfield 3"
    id: touchfield_3
    on_press:
      - if:
          condition:
            lambda: "return ${toggle_relay_3_on_touch};"
          then:
            - switch.toggle: relay_3
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: touchfield_3
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Swipe left"
    id: swipe_left
    on_press:
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: swipe_left
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Swipe_right"
    id: swipe_right
    on_press:
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: swipe_right
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Multi Touch"
    id: multi_touch
    on_press:
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: multi_touch
          state: OFF
      - script.execute: refresh_led_default

  - platform: template
    name: "Long Press"
    id: long_press
    on_press:
      - delay: ${button_on_time}
      - binary_sensor.template.publish:
          id: long_press
          state: OFF
      - script.execute: refresh_led_default

switch:
  - platform: gpio
    id: relay_1
    name: "${friendly_name} L1"
    pin: ${relay_1_pin}
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
        - script.execute: refresh_led_default
    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: gpio
    id: relay_2
    name: "${friendly_name} L2"
    pin: ${relay_2_pin}
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
        - script.execute: refresh_led_default
    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: gpio
    id: relay_3
    name: "${friendly_name} L3"
    pin: ${relay_3_pin}
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
        - script.execute: refresh_led_default
    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: gpio
    id: vibra
    pin: ${vibra_motor_pin}
    name: "${friendly_name} Vibration"
    restore_mode: ALWAYS_OFF
    on_turn_on:
      - delay: ${vibra_time}
      - switch.turn_off: vibra

  - platform: gpio
    id: pa_power
    pin: ${pa_power_pin}
    name: "PA Power"
    internal: true
    restore_mode: ALWAYS_ON

  - platform: gpio
    name: "touch panel power"
    pin:
      number: ${touchpanel_power_pin}
      inverted: true
    id: touch_power
    internal: true
    restore_mode: RESTORE_DEFAULT_ON

  - platform: template
    name: "Nightlight"
    id: nightlight
    internal: true
    optimistic: true
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
        - script.execute: refresh_led_default
    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: template
    name: "Nightlight"
    id: nightlight_active
    optimistic: true
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      then:
        - script.execute: refresh_led_default
    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: restart
    name: "${friendly_name} Restart"

light:
  - platform: neopixelbus
    type: GRB
    variant: WS2811
    pin: ${led_pin}
    num_leds: 28
    name: "NeoPixel Light"
    id: leds
    default_transition_length: 0s
    effects:
      - addressable_rainbow:
          name: "Rainbow"
          speed: 30
          width: 8
      - pulse:
          name: "Pulse"
          transition_length: 1.4s
          update_interval: 1s

    on_turn_off:
      then:
        - script.execute: refresh_led_default

  - platform: partition
    name: "LEDs Button right"
    id: leds_button_right
    internal: true
    segments:
      - id: leds
        from: 7
        to: 7
  - platform: partition
    name: "LEDs Button middle"
    id: leds_button_middle
    internal: true
    segments:
      - id: leds
        from: 9
        to: 9
  - platform: partition
    name: "LEDs Button left"
    id: leds_button_left
    internal: true
    segments:
      - id: leds
        from: 11
        to: 11

  - platform: partition
    name: "LEDs Nightlight"
    id: leds_nightlight
    internal: true
    segments:
      - id: leds
        from: 0
        to: 6
      - id: leds
        from: 8
        to: 8
      - id: leds
        from: 10
        to: 10
      - id: leds
        from: 12
        to: 19
      - id: leds
        from: 27
        to: 27
      - id: leds_top
        from: 0
        to: 6

  - platform: partition
    name: "LEDs Top"
    id: leds_top
    internal: true
    segments:
      - id: leds
        from: 20
        to: 26
    effects:
      - addressable_scan:
          name: "Scan"
      - addressable_rainbow:
          name: "Rainbow"
          speed: 10
          width: 20

#media_player:
#  - platform: i2s_audio
#    id: media_out
#    name: ${friendly_name} Player
#    dac_type: external
#    i2s_dout_pin: ${audio_sdata_pin}
#    i2s_audio_id: audio_i2s
#    i2s_comm_fmt: lsb    
#    mode: mono

#i2s_audio:
#  id: audio_i2s
#  i2s_lrclk_pin: ${audio_lrclk_pin}
#  i2s_bclk_pin: ${audio_bclk_pin}

uart:
  tx_pin: ${uart_tx_pin}
  rx_pin: ${uart_rx_pin}
  id: my_uart
  baud_rate: 115200
  data_bits: 8
  stop_bits: 1
  parity: NONE
  debug:
    direction: RX
    dummy_receiver: false
    after:
      timeout: 2s
      bytes: 2048
    sequence:
      - lambda: UARTDebug::log_hex(direction, bytes, ' ');

tx_ultimate_touch:
  id: tx_touch
  uart: my_uart

  on_press:
    - script.execute: led_on_touch
    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_press", "Touch Position: %d / State: %d", touch.x, touch.state);

  on_release:
    - script.execute:
        id: handle_release
        pos: !lambda "return touch.x;"

    - switch.turn_on: vibra

    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_release", "Release Position: %d / State: %d", touch.x, touch.state);

  on_swipe_left:
    - script.execute: led_on_swipe_left

    - switch.turn_on: vibra

    - binary_sensor.template.publish:
        id: swipe_left
        state: ON

    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_swipe_left", "Swipe Left Position: %d / State: %d", touch.x, touch.state);

  on_swipe_right:
    - script.execute: led_on_swipe_right

    - switch.turn_on: vibra

    - binary_sensor.template.publish:
        id: swipe_right
        state: ON

    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_swipe_right", "Swipe Right Position: %d / State: %d", touch.x, touch.state);

  on_full_touch_release:
    - script.execute: led_on_full_touch

    - switch.turn_on: vibra

    - binary_sensor.template.publish:
        id: multi_touch
        state: ON

    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_full_touch_release", "Full Touch Release Position: %d / State: %d", touch.x, touch.state);

  on_long_touch_release:
    - script.execute: led_on_long_touch

    - switch.turn_on: vibra

    - binary_sensor.template.publish:
        id: long_press
        state: ON

    - lambda: >
        ESP_LOGD("tx_ultimate_touch.on_long_touch_release", "Long Touch Release Position: %d / State: %d", touch.x, touch.state);

time:
  - platform: homeassistant
  - platform: sntp
    on_time:
      # Every 5 minutes
      - seconds: 0
        minutes: /5
        then:
          - script.execute: refresh_nightlight

sun:
  latitude: ${latitude}
  longitude: ${longitude}


script:
  - id: refresh_nightlight
    mode: restart
    then:
      - if:
          condition:
            lambda: 'return "${nightlight}" == "on";'
          then:
            - if:
                condition:
                  - sun.is_below_horizon:
                then:
                  - switch.turn_on:
                      id: nightlight
                else:
                  - switch.turn_off:
                      id: nightlight

  - id: refresh_led_default
    mode: restart
    then:
      - light.turn_off: leds_top

      - if:
          condition:
            lambda: "return (${relay_count}>1 && id(relay_1).state) ;"
          then:
            - script.execute: led_on_button_left
          else:
            - script.execute: led_off_button_left

      - if:
          condition:
            lambda: "return (${relay_count}==3 && id(relay_2).state) || (${relay_count}==1 && id(relay_1).state);"
          then:
            - script.execute: led_on_button_middle
          else:
            - script.execute: led_off_button_middle

      - if:
          condition:
            lambda: "return (${relay_count}==2 && id(relay_2).state) || (${relay_count}==3 && id(relay_3).state);"
          then:
            - script.execute: led_on_button_right
          else:
            - script.execute: led_off_button_right

      - if:
          condition:
            lambda: "return id(nightlight).state || id(nightlight_active).state;"
          then:
            - script.execute: led_on_nightlight
          else:
            - light.turn_off: leds_nightlight

  - id: led_on_button_left
    mode: restart
    then:
      - light.turn_on:
          id: leds_button_left
          brightness: ${button_brightness}
          red: !lambda "return id(button_color)[0]/100.0;"
          green: !lambda "return id(button_color)[1]/100.0;"
          blue:  !lambda "return id(button_color)[2]/100.0;"

  - id: led_on_button_middle
    mode: restart
    then:
      - light.turn_on:
          id: leds_button_middle
          brightness: ${button_brightness}
          red: !lambda "return id(button_color)[0]/100.0;"
          green: !lambda "return id(button_color)[1]/100.0;"
          blue:  !lambda "return id(button_color)[2]/100.0;"

  - id: led_on_button_right
    mode: restart
    then:
      - light.turn_on:
          id: leds_button_right
          brightness: ${button_brightness}
          red: !lambda "return id(button_color)[0]/100.0;"
          green: !lambda "return id(button_color)[1]/100.0;"
          blue:  !lambda "return id(button_color)[2]/100.0;"


  - id: led_off_button_left
    mode: restart
    then:
      - if:
          condition:
            lambda: "return id(nightlight).state || id(nightlight_active).state;"
          then:
            - light.turn_on:
                id: leds_button_left
                brightness: ${nightlight_brightness}
                red: !lambda "return id(nightlight_color)[0]/100.0;"
                green: !lambda "return id(nightlight_color)[1]/100.0;"
                blue:  !lambda "return id(nightlight_color)[2]/100.0;"
          else:
            - light.turn_off:
                id: leds_button_left

  - id: led_off_button_middle
    mode: restart
    then:
      - if:
          condition:
            lambda: "return id(nightlight).state || id(nightlight_active).state;"
          then:
            - light.turn_on:
                id: leds_button_middle
                brightness: ${nightlight_brightness}
                red: !lambda "return id(nightlight_color)[0]/100.0;"
                green: !lambda "return id(nightlight_color)[1]/100.0;"
                blue:  !lambda "return id(nightlight_color)[2]/100.0;"
          else:
            - light.turn_off:
                id: leds_button_middle


  - id: led_off_button_right
    mode: restart
    then:
      - if:
          condition:
            lambda: "return id(nightlight).state || id(nightlight_active).state;"
          then:
            - light.turn_on:
                id: leds_button_right
                brightness: ${nightlight_brightness}
                red: !lambda "return id(nightlight_color)[0]/100.0;"
                green: !lambda "return id(nightlight_color)[1]/100.0;"
                blue:  !lambda "return id(nightlight_color)[2]/100.0;"
          else:
            - light.turn_off:
                id: leds_button_right


  - id: led_on_nightlight
    mode: restart
    then:
      - light.turn_on:
          id: leds_nightlight
          brightness: ${nightlight_brightness}
          red: !lambda "return id(nightlight_color)[0]/100.0;"
          green: !lambda "return id(nightlight_color)[1]/100.0;"
          blue:  !lambda "return id(nightlight_color)[2]/100.0;"

  - id: led_on_release
    mode: restart
    then:
      - light.turn_off:
          id: leds_top

  - id: led_on_touch
    mode: restart
    then:
      - light.turn_on:
          id: leds_top
          brightness: ${touch_brightness}
          red: !lambda "return id(touch_color)[0]/100.0;"
          green: !lambda "return id(touch_color)[1]/100.0;"
          blue:  !lambda "return id(touch_color)[2]/100.0;"
          effect: ${touch_effect}
      - delay: 6s
      - script.execute: refresh_led_default

  - id: led_on_swipe_left
    mode: restart
    then:
      - light.turn_on:
          id: leds_top
          brightness: ${swipe_left_brightness}
          red: !lambda "return id(swipe_left_color)[0]/100.0;"
          green: !lambda "return id(swipe_left_color)[1]/100.0;"
          blue:  !lambda "return id(swipe_left_color)[2]/100.0;"
          effect: ${swipe_left_effect}

  - id: led_on_swipe_right
    mode: restart
    then:
      - light.turn_on:
          id: leds_top
          brightness: ${swipe_right_brightness}
          red: !lambda "return id(swipe_right_color)[0]/100.0;"
          green: !lambda "return id(swipe_right_color)[1]/100.0;"
          blue:  !lambda "return id(swipe_right_color)[2]/100.0;"
          effect: ${swipe_right_effect}

  - id: led_on_full_touch
    mode: restart
    then:
      - light.turn_on:
          id: leds_top
          brightness: ${multi_touch_brightness}
          red: !lambda "return id(multi_touch_color)[0]/100.0;"
          green: !lambda "return id(multi_touch_color)[1]/100.0;"
          blue:  !lambda "return id(multi_touch_color)[2]/100.0;"
          effect: ${multi_touch_effect}


  - id: led_on_long_touch
    mode: restart
    then:
      - light.turn_on:
          id: leds_top
          brightness: ${long_press_brightness}
          red: !lambda "return id(long_press_color)[0]/100.0;"
          green: !lambda "return id(long_press_color)[1]/100.0;"
          blue:  !lambda "return id(long_press_color)[2]/100.0;"
          effect: ${long_press_effect}


  - id: handle_release
    mode: restart
    parameters:
      pos: int
    then:
      - if:
          condition:
            lambda: "return ${relay_count}==1;"
          then:
            - binary_sensor.template.publish:
                id: touchfield_1
                state: ON

      - if:
          condition:
            lambda: "return ${relay_count}==2;"
          then:
            - if:
                condition:
                  lambda: "return pos <= 5;"
                then:
                  - binary_sensor.template.publish:
                      id: touchfield_1
                      state: ON

                else:
                  - binary_sensor.template.publish:
                      id: touchfield_2
                      state: ON

      - if:
          condition:
            lambda: "return ${relay_count}==3;"
          then:
            - if:
                condition:
                  lambda: "return pos <= 3;"
                then:
                  - binary_sensor.template.publish:
                      id: touchfield_1
                      state: ON

                else:
                  - if:
                      condition:
                        lambda: "return pos <= 7;"
                      then:
                        - binary_sensor.template.publish:
                            id: touchfield_2
                            state: ON

                      else:
                        - binary_sensor.template.publish:
                            id: touchfield_3
                            state: ON

  - id: touch_led_marker
    mode: restart
    parameters:
      state: int
      pos: int
    then:
      - if:
          condition:
            lambda: "return state==1;"
          then:
            # RELEASE
            - light.turn_off: leds

          else:
            - if:
                condition:
                  lambda: "return state==2;"
                then:
                  # TOUCH
                  - light.turn_on:
                      id: leds
                      red: 1
                      green: 0
                      blue: 0
                  - delay: 6s
                  - light.turn_off: leds

                else:
                  - if:
                      condition:
                        lambda: "return state==11;"
                      then:
                        # FULL-TOUCH RELEASE
                        - light.turn_on:
                            id: leds
                            effect: "Rainbow"
                        - delay: 1s
                        - light.turn_off: leds

                      else:
                        # SWIPE
                        - if:
                            condition:
                              lambda: "return state==13;"
                            then:
                              # SWIPE LEFT
                              - light.turn_on:
                                  id: leds
                                  red: 0
                                  green: 1
                                  blue: 0

                        - if:
                            condition:
                              lambda: "return state==12;"
                            then:
                              # SWIPE RIGHT
                              - light.turn_on:
                                  id: leds
                                  red: 0
                                  green: 0
                                  blue: 1
                        - delay: 1s
                        - light.turn_off: leds`


from sonoff-tx-ultimate-for-esphome.

robbiedehand avatar robbiedehand commented on July 17, 2024

@letsautomatenet

I finally got it to work! Here were my issues in case someone else has similar:

  • The URL presented by Home Assistant is my https external URL, as this is what is required for TTS with Google Home. This was not resolving/being blocked by my firewall for my ESP device. I assigned the ESP device a DNS address of my local AdGuard DNS server with a local rewrite rule to the HA ip address to prevent any potential DNS loopback/hairpin issues
  • Some of my MP3s simply don't play on it. So when I thought I hadn't resolved the comms issue, I in fact had. Perhaps it's the encoding of these MP3s it doesn't like. The same files play on the Google speakers.

It is indeed pretty quiet.

how did you see that is was blocked? i allready got adgaurd dns rewrites, but i suspect i have the sam isseu, i cant pinpoint it though

from sonoff-tx-ultimate-for-esphome.

the-mentor avatar the-mentor commented on July 17, 2024

Anyone knows what's the i2c audio chip by any chance?

from sonoff-tx-ultimate-for-esphome.

the-mentor avatar the-mentor commented on July 17, 2024

I found this from Jessie on the esphome discord

`media_player` volume is software driven, but if the amp itself has a default low max volume setting and can be configured via i2c etc then it needs its own compoennt to do that configuration at boot

Maybe we need to figure it out somewhere

from sonoff-tx-ultimate-for-esphome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.