Came ZA3 gate controller with ESPHome

Thank you, this works great.
I could make it work with a Shelly UNI without flashing to Tasmota (including the integration in Home-assistant). @MARn @acesyde @nau Why did you choose to flash it ?
Merci !

Hi,
Thanks for all information posted here.
My gate has a Came BXV controller and I also wanted to control it from Home Assistant, so I used a D1mini (ESP8266) with ESPHome to build the cover.
I am sensing information both from the limit switches to determine when the gate is fully open or closed, and also from the motor to know if the gate is moving (and in which direction). This allows ESPHome to evaluate the position of the gate, even if it is controlled using the original Came remote control.
Here is a demo video: https://youtu.be/gJ1Nn_VbDwY
And all details, code and schematics are in this blog post:
Introducing CHAI - a CAME gate controller to Home Assistant Interface - Vince's thoughts
Happy hacking !

Vincent

1 Like

Hello, community!

Could someone please help me to debug or understand the issue?

I have added Shelly Uni flashed to ESPHome to my Came ZF1 gates controller. Thanks, @MARn, for the diagram.

I can open and close the gates but struggle to get open/closed status. Initially, I had an issue with the sensor reporting many state changes every second. After adding delayed_on_off, this is resolved, but I can’t get the status of the gate.

Based on the manual, on terminal 10-5, an open gate indicator can be mounted. But I can’t get its status using my Shelly.

I have attached a light bulb to confirm that the motherboard is operating correctly. The light bulb lights up when opening the gate and turns off after a short delay when the gate is closed. Here is the recording.

Here is my yaml file for Shelly:

esphome:
  name: garage-gates-opener
  friendly_name: Garage gates opener

esp8266:
  board: esp_wroom_02
  restore_from_flash: true

logger:
  esp8266_store_log_strings_in_flash: False
  level: DEBUG

web_server:
  port: 80

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: !secret gates_ap_ssid
    password: !secret gates_ap_password

api:
  encryption:
    key: !secret gates_api_encryption_key

ota:
  password: !secret gates_ota_password

# Input
#GPIO12 (1)
#GPIO13 (2)

# Output (Relay)
# GPIO04 (2)
# GPIO15 (1)

sensor:
  - platform: wifi_signal
    name: "RSSI"
    id: sensor_rssi
    update_interval: 90s
    entity_category: "diagnostic"

  - platform: uptime
    name: "Uptime"
    id: sensor_uptime
    update_interval: 300s
    entity_category: "diagnostic"

switch:
  - platform: gpio
    pin: GPIO15
    name: "Gate Switch"
    icon: "mdi:gate"
    id: gate_switch
    on_turn_on:
      - delay: 500ms
      - switch.turn_off: gate_switch
  - platform: gpio
    id: adc_range
    name: ADC Range
    pin: GPIO14
    restore_mode: RESTORE_DEFAULT_ON
  
binary_sensor:

  - platform: gpio
    name: "Close Sensor"
    id: is_gate_closed
    pin:
      number: GPIO12
      mode: INPUT_PULLUP
      inverted: false
    filters:
       - delayed_on_off: 60ms

light:
  - platform: status_led
    name: "LED"
    id: led_status
    pin:
      number: GPIO00
      inverted: True
    internal: True
    restore_mode: ALWAYS_OFF

cover:
  - platform: template
    name: "Gates"
    icon: "mdi:gate"
    device_class: gate
    lambda: |-
      if (id(is_gate_closed).state) {
        return COVER_CLOSED;
      } else {
        return COVER_OPEN;
      }
    open_action:
      - switch.turn_on: gate_switch
    close_action:
      - switch.turn_on: gate_switch
    stop_action:
      - switch.turn_on: gate_switch
    optimistic: true
    assumed_state: false

captive_portal:

I think my previous message was unclear about what ‘can’t get the status’ means. When I open or close the gate, the sensor’s state changes several times to open or close. The sensor’s state doesn’t match the state of the lightbulb when it was connected. Or, without any operations, the status changes from ON to OFF and vice versa.

Did you ever get this to work? I am having similar problems with a zm3. Gate opens and closes OK, but the status isn’t working. Will do some more checking tomorrow if it stops raining.

any news?
I have a ZM3E and would also like to get the gate status on HA :slight_smile:

I also use a Shelley Uni (currently tasmota) and had to manipulate the analog value to get a consistent result. The reading sits at close to 500 when it’s open, and around 4 when it’s closed. One other thing I did was add a power converter to convert Came’s ~24V AC to a steady 12V DC. I know the Shelley spec says it should work directly on the AC which was more elegant, but this really seems to have helped. If they bring out a version with three relays I’ll swap it in so I can directly switch open, close and stop.

I don’t have partial state working with this yet, but it always knows if it’s open or closed. The cover definition is what I normally use - the binary sensor is handy for other scripts - such as flashing a light when the back door is opened if the gate is open too.

template:
    binary_sensor: 
    - name: frontgate_state
      unique_id: 09f5e-6a80977-fd5cf0-9fff-60e1e2d3e26d
      device_class: garage_door
      state: "{{ states('sensor.shelley_uni_gate_analog_a0')| float(0) >10 }}"

cover:
  - platform: template
    covers:
      gate_as_cover:
        device_class: gate
        friendly_name: "Main Gate"
        position_template: "{{ (states('sensor.shelley_uni_gate_analog_a0')| float / 10 ) | round (0) }}"
        open_cover:
          service: script.open_gate
        close_cover:
          service: script.close_gate
        stop_cover:
          service: script.stop_gate

Hey Guys,
Thank you for the good advice in this article. I was also reasonably successful in connecting a Shelly Uni to the Came BXV06. The function of opening and closing the gate works so far. However, I only connected power and [OUT 2] to 2 and 7. However, as soon as I connect [IN1] and [IN2] to [FC] and [FA], the door stops briefly, moves on, stops, moves on… etc.

Does anyone have any idea what the problem could be? Does the Shelly Uni need a special setting or is it more due to the programming of the operator?

I would be really grateful if someone could help me.

Thanks
Peter

1 Like