How to create a smart button

Hello all,

I have already googled a bit, but did not find what I am looking for. Let me summarize:
I have two Tapo cameras. I would now like to have a button on the dashboard with which I can activate the motion detection and person detection of both cameras with just one press of a button. And deactivate them again with another press of the button.

The entities would be the following:
select.tapo_cam_carport_motion_detection
select.tapo_cam_carport_person_detection

select.tapo_cam_terrace_motion_detection
select.tapo_cam_terrace_person_detection

With standard tools I get, as a loaner, only done, that it addresses one of the two cameras and also only one of the two entities in each case. And pressing the button again does not deactivate the state :confused:

Another problem: Motion Detection and Person Detection do not have the state On and Off, but High, Normal, Low and Off.

Maybe you have some ideas or even tinkered something already. Custom button-cards could solve the problem, but I don’t know how to include the different entities in the code.

Many greetings
7vn

Whenever you want to have multiple actions happen from a single button press, you must first create a script that handles the service calls and any control logic. Then you can have the button press call the script as a service.