jesserockz / wizmote-esphome

Apache License 2.0
67 stars 30 forks source link

Wiz Smart Button #18

Open micw opened 1 year ago

micw commented 1 year ago

Not an issue. Just wanted you to know that "Wiz Smart Button" (https://www.wizconnected.com/en-gb/p/accessory-smart-button/8719514554795) also works. Button IDs are

100: on 101: off 102: brightness plus (long-press to "on") 102: brightness minus (long-press to "off")

ImaZen88 commented 8 months ago

Hello, I would like to ask you, where can i change those IDs. Thanks in advance

micw commented 8 months ago

You use it in your config, see example:

      condition:
        lambda: return data.button >= 16 && data.button <= 19;

Buttons on this remote are 100...102.

ImaZen88 commented 8 months ago

Thanks a lot, but I still have no events in event log.

esphome:
  name: wiz-bridge
  friendly_name: wiz-bridge

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "1x6vW9uDccJbWrdPja9P0ElthJ7Exd4bc5vYzdhMNHY="

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Wiz-Bridge Fallback Hotspot"

captive_portal:

external_components:
  - source: github://jesserockz/wizmote-esphome
    components:
      - esp_now
      - wizmote

esp_now:

wizmote:
  on_button:
    if:
      condition:
        lambda: return data.button >= 100 && data.button <= 102;
      then:
        - homeassistant.event:
            event: esphome.wizmote_choose
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button - 99;'
              sequence: !lambda 'return data.sequence;'
      else:
        - homeassistant.event:
            event: esphome.wizmote_action
            data:
              mac: !lambda 'return format_hex(data.bssid, 6);'
              button: !lambda 'return data.button;'
              sequence: !lambda 'return data.sequence;'

I am grateful for such a fast response, but I am really lost here, did you encounter this problem too and if, how did you solve it? Thanks

(I have the mac address in lowercase no separation 444f8eb051f9 format) (It's printing [20:12:38][D][esp_now:072]: mac: 44.4F.8E.B0.51.F9 (6), data: 91.C4.01.00.00.20.64.01.64.59.E5.DC.7E (13) in ESPHome console) (I a listening to * in event log)

ImaZen88 commented 8 months ago

image This is trace when i run the automation manually

ImaZen88 commented 8 months ago

It's not working even if I remove the condition (no event log)

esphome:
  name: wiz-bridge
  friendly_name: wiz-bridge

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "1x6vW9uDccJbWrdPja9P0ElthJ7Exd4bc5vYzdhMNHY="

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Wiz-Bridge Fallback Hotspot"

captive_portal:

external_components:
  - source: github://jesserockz/wizmote-esphome
    components:
      - esp_now
      - wizmote

esp_now:

wizmote:
  on_button:
      - homeassistant.event:
          event: esphome.wizmote_test
          data:
            mac: !lambda 'return format_hex(data.bssid, 6);'
            button: !lambda 'return data.button - 99;'
            sequence: !lambda 'return data.sequence;'    
micw commented 8 months ago

Check the log on the esp32 first. In the "logger" section you can set the log level to "debug".

You also need this setting to make it work reliable:

https://github.com/jesserockz/wizmote-esphome/issues/8#issuecomment-1781223397

ImaZen88 commented 8 months ago

Found out it defaults to debug, so I still see only the [D][esp_now:072]: mac: 44.4F.8E.B0.51.F9 (6), data: 91.6F.02.00.00.20.64.01.64.0F.D4.D6.F4 (13) in esp logs, and nothing from esphome in events log And I added the power save mode