Zigbee cc2530 as Router controlling an external switch

Hello all,

I’m new to all like home automation and so on.

I’ve installed Home Assistants on virtual box with a coordinator (Sonof ZBDongle -E) in z2mqtt and a preflashed (with PTVO) CC2530 (GPIO P04). Everythin is setup and is working in the network.
Now I want to controll sth via the p04 on the cc2530. In my case an standard external switch like you can get on aliexpress. It has an trigger voltage of 3.0 volts. Wireing is done. Just need signal on P04 with the software.
This switch should (just for testing if it works), when launching HA automatically turn on and off in an intervall like 30sec off 2 sec on.

where do I have to start and what do I need. I read something about python and the config’s of HA and z2mqtt. And what about the automoation.yaml?

I’m a completely nooby in this.

Thank you for your effort in advance :slight_smile:

ok, is this a possible approach? I define port 21 to be the output.

'
# Loads default set of integrations. Do not remove.
default_config:
    

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

# Text to speech
tts:
  - platform: google_translate
  
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

   - platform: mqtt
     name: "TEST"
     state_topic: "zigbee2mqtt/Lampe2"
     retain: true
     payload_available: 'true'
     payload_not_available: 'false'
     availability_topic: 'zigbee2mqtt/bridge/state'
     payload_available: "online"
     payload_not_available: "offline"
     gpio:
       - pins:
           - 21
         mode: output

While testing it with the command in the terminal in home assistant:

mosquitto_pub -h core-mosquitto -t zigbee2mqtt/Lampe2/set -m ‘{“gpio”: {“21”: true}}’

it will not cause the action i need…

ok now I think I’m on the right way?



mqtt:
  switch:
    - unique_id: 0x00124b0003364a01
    name: "NEUERTEST"
    state_topic: "zigbee2mqtt/0x00124b0003364a01/l1"
    command_topic: "zigbee2mqtt/0x00124b0003364a01/l1/set"
    availability:
      - topic: "zigbee2mqtt/0x00124b0003364a01/l1/available"
    payload_on: "ON"
    payload_off: "OFF"
    state_on: "ON"
    state_off: "OFF"
    optimistic: false
    qos: 0
    retain: true


Unfortunately, the switch on the dashboard didn’t work and the relay on the router couldn’t be triggered.
For manual testing via the terminal with the command mosquitto_sub -h localhost -u user -P pass -t ‘devices/#’ (of course with my settings) unfortunately nothing.

Have I perhaps forgotten or overlooked a step somewhere or am I completely wrong?

I am very grateful for your efforts.

Best regards

Download mqtt explorer (https://mqtt-explorer.com/), press your switch and see what happens.

doesn’t work unfortunately. When I want to login with mqtt settings it says always disc from server…

hello again,

I tried the Sonoff dongle -P version and it worked straight away. So the version -E has caused the issue.