Change switch status as a result of the other sensor (action)

Hello,
i am trying to setup a simple automation, once i press zigbee button i want to change the state of the other switch.
I went thru the forum, and found thread How to manually set state/value of sensor? - #77 by petro
where they use custom service/script > service: python_script.set_state

and then some other custom made code which utilizes the python script.

service: python_script.set_state
data_template:
  entity_id: binary_sensor.wallpanel_entrance_sensor_motion
  state: >
    {% if trigger.to_state.state == 'off' %}
      Unavailable
    {% else %}
      {% set sensor_state = states('binary_sensor.wallpanel_entrance_sensor_motion') %}
      {{ 'Clear' if sensor_state == 'Unavailable' else sensor_state }}
    {% endif %}

I was wondering if there is some simpler option to do that these days?

All i want to do is as mentioned, once i press the zigbee button, it shoud change the state of the switch ie if the switch status is on → off , or off->on.

Thank you

A switch is not a sensor.

All you need to do in the action part of the automation is call service switch:toggle

lovely, thanks!