sillyfrog / contact

Contact Me and useful links
1 stars 0 forks source link

3A Smart Home 3 gang switch #3

Open sillyfrog opened 5 years ago

sillyfrog commented 5 years ago

Not an issue, just somewhere to record some information. A bunch of photos of the internals of the 3A smart home switch. (Purchased from ebay at https://www.ebay.com.au/itm/Smart-WiFi-Desk-Lamp-Light-Switch-Dimmer-GPO-4-Google-Home-Alexa-Voice-Control/183336271514 ). Used to help get a template for Tasmota

This is a 3A Smart Home Wi-Fi Three Gang Smart Switch, model HGZB-043.

The logic board behind the face plate includes the numbers:

120K3S_WIFI_SV5
FR4 94V0
T=1.0MM
20181011

Logic board behind cover Logic board back Relay board Relay board back

danps1 commented 5 years ago

I have a bunch of these working really well with Home Assistant and ESPHome. I really like them. Here is an example config for ESPHome in case you're looking to use that...

esphome:
  build_path: './build'
  name: xxxxxxxxxx
  platform: ESP8266
  board: esp01_1m
  on_loop:
    lambda: |-
      if (id(light_1).current_values.is_on()) {
        id(led_1).turn_on();
      } else {
        id(led_1).turn_off();
      }
      if (id(light_2).current_values.is_on()) {
        id(led_2).turn_on();
      } else {
        id(led_2).turn_off();
      }
      if (id(light_3).current_values.is_on()) {
        id(led_3).turn_on();
      } else {
        id(led_3).turn_off();
      }

wifi:
  ssid: 'xxxxxxxxxx'
  password: 'xxxxxxxxxx'
  domain: 'xxxxxxxxxx'
  use_address: xxx.xxx.xxx.xxx

api:
  password: 'xxxxxxxxxx'
  reboot_timeout: 0s

ota:

logger:

binary_sensor:
  - platform: gpio
    pin: 
      number: 12
      inverted: true
    id: button_1
    internal: true 
    on_press: 
      then:
        - light.toggle:
            id: light_1
    on_multi_click:
    - timing:
        - ON for at least 500ms
      then:
        - light.turn_off:
            id: light_1
        - light.turn_off:
            id: light_2
        - light.turn_off:
            id: light_3

  - platform: gpio
    pin: 
      number: 3
      inverted: true
    id: button_2
    internal: true
    on_press: 
      then:
        - light.toggle:
            id: light_2

  - platform: gpio
    pin: 
      number: 5
      inverted: true
    id: button_3
    internal: true
    on_press: 
      then:
        - light.toggle:
            id: light_3
    on_multi_click:
    - timing:
        - ON for at least 500ms
      then:
        - light.turn_on:
            id: light_1
        - light.turn_on:
            id: light_2
        - light.turn_on:
            id: light_3
output:
  - platform: gpio
    pin: 13
    id: relay_1

  - platform: gpio
    pin: 4
    id: relay_2

  - platform: gpio
    pin: 15
    id: relay_3

  - platform: gpio
    pin: 16
    id: led_1

  - platform: gpio
    pin: 14
    id: led_2

  - platform: gpio
    pin: 2
    id: led_3

status_led:
  pin: 0

light:
  - platform: binary
    name: 'Light 1'
    id: light_1
    output: relay_1

  - platform: binary
    name: 'Light 2'
    id: light_2
    output: relay_2

  - platform: binary
    name: 'Light 3'
    id: light_3
    output: relay_3
sillyfrog commented 5 years ago

Thanks! I'm looking to move to Home Assistant shortly, and this will help heaps!

buzurk26 commented 4 years ago

Anyone successfully using the single gang dimmer version with tasmota or esphome

I have a bunch of these working really well with Home Assistant and ESPHome. I really like them. Here is an example config for ESPHome in case you're looking to use that...

esphome:
  build_path: './build'
  name: xxxxxxxxxx
  platform: ESP8266
  board: esp01_1m
  on_loop:
    lambda: |-
      if (id(light_1).current_values.is_on()) {
        id(led_1).turn_on();
      } else {
        id(led_1).turn_off();
      }
      if (id(light_2).current_values.is_on()) {
        id(led_2).turn_on();
      } else {
        id(led_2).turn_off();
      }
      if (id(light_3).current_values.is_on()) {
        id(led_3).turn_on();
      } else {
        id(led_3).turn_off();
      }

wifi:
  ssid: 'xxxxxxxxxx'
  password: 'xxxxxxxxxx'
  domain: 'xxxxxxxxxx'
  use_address: xxx.xxx.xxx.xxx

api:
  password: 'xxxxxxxxxx'
  reboot_timeout: 0s

ota:

logger:

binary_sensor:
  - platform: gpio
    pin: 
      number: 12
      inverted: true
    id: button_1
    internal: true 
    on_press: 
      then:
        - light.toggle:
            id: light_1
    on_multi_click:
    - timing:
        - ON for at least 500ms
      then:
        - light.turn_off:
            id: light_1
        - light.turn_off:
            id: light_2
        - light.turn_off:
            id: light_3

  - platform: gpio
    pin: 
      number: 3
      inverted: true
    id: button_2
    internal: true
    on_press: 
      then:
        - light.toggle:
            id: light_2

  - platform: gpio
    pin: 
      number: 5
      inverted: true
    id: button_3
    internal: true
    on_press: 
      then:
        - light.toggle:
            id: light_3
    on_multi_click:
    - timing:
        - ON for at least 500ms
      then:
        - light.turn_on:
            id: light_1
        - light.turn_on:
            id: light_2
        - light.turn_on:
            id: light_3
output:
  - platform: gpio
    pin: 13
    id: relay_1

  - platform: gpio
    pin: 4
    id: relay_2

  - platform: gpio
    pin: 15
    id: relay_3

  - platform: gpio
    pin: 16
    id: led_1

  - platform: gpio
    pin: 14
    id: led_2

  - platform: gpio
    pin: 2
    id: led_3

status_led:
  pin: 0

light:
  - platform: binary
    name: 'Light 1'
    id: light_1
    output: relay_1

  - platform: binary
    name: 'Light 2'
    id: light_2
    output: relay_2

  - platform: binary
    name: 'Light 3'
    id: light_3
    output: relay_3

Anyone successfully using the single gang dimmer version with tasmota or esphome

klaw81 commented 4 years ago

How are people flashing these devices? Serial adaptor or OTA?

sillyfrog commented 4 years ago

I use this: https://github.com/ct-Open-Source/tuya-convert - and I highly recommend it! The latest version has been very robust, and allowed me to flash a number of different devices without having to open them up.

You do have to keep in mind that it could in theory go bad, and you'll need to pull everything apart, and flash over serial. That said, I have never had an issue, if it ever went wrong, it just didn't do anything and it was still running the original firmware. You just need to be patient during actual flashing - as sometimes the callbacks etc can take a minute or two. Also carefully read the prompts and ensure you do what it says (connecting to the WiFi etc). I run it on an old laptop I have running Debian.

klaw81 commented 4 years ago

Wow, thanks for the fast reply. I am having no joy with serial flashing so I will give Tuya Convert a try. How do you trigger the wifi pairing mode on this device?

sillyfrog commented 4 years ago

I think it was just hold down a button (probably the top) for 5-10 seconds - after a while it'll start flashing (and probably clicking when it starts). It'll be in pairing mode for several minutes before falling back. The Tuya Convert script needs full access to the WiFi card as it broadcasts the configuration using WiFi multicast (so you don't actually ever connect to the switch, rather it's told to connect to the Tuya Convert).

klaw81 commented 4 years ago

I have successfully flashed a 2-gang and 3-gang version of this switch with Tasmota using the Tuya Convert OTA method.

When the switch is powered up, the top button will slowly flash green. Long-pressing this button for ~10 seconds will enter WiFi pairing mode, and then the Tuya Convert process takes over.

I found the 3-gang template here: https://templates.blakadder.com/3a_HGZB-043.html but haven't seen a suitable template for the 2-gang version of this switch.

kevincw01 commented 4 years ago

Hi guys. I have this working with tasmota and home assistant thanks to your comments above. The only problem I see is that only button 1 shows a different color when its on and off. The other two buttons functionally work, but they don't change colors. I did configure using the template provided by @klaw81 . Any ideas how to correct?

I am also wondering if @danps1 has the same experience with esphome and this switch. If his has the correct colors, maybe I should switch to esphome instead of tasmota. I have no experience with esphome so I'm hesitant to try it.

sillyfrog commented 4 years ago

I'm no longer using this, but have a vague memory that the top button actually had 2 LED's (one for WiFi, one for the actual switch). I think you need to make the red/orange LED just show the WiFi status and not toggle with relay 1.

sillyfrog commented 4 years ago

O yeah, see here: https://templates.blakadder.com/3a_HGZB-043.html This shows what each pin does - and from my comments when I put up the template, I think if you change the LED's to be LedLink(x), you should be able to get them to sync with the relays, and have an LED for the WiFi status.

kevincw01 commented 4 years ago

@sillyfrog I am trying to get all the LEDs off. You ledlink suggestion worked with gpio0. Now location A only blinks on wifi/mqtt which is fine. But location c is stuck as either red or blue. Any ideas? Untitled