API post do nothing


I’ve wrote this python scripts to turn on lights with HA.

    for i in range (len(lights_inv)+1):
        headers = {
            "Authorization": "Bearer " + str(config['Account']['gb_token']),
            "content-type": "application/json",
        data = {"entity_id":lights_inv["hlights"][i]["entity_id"]}
        url = "http://homeassistant.goldenbyte.it:8123/api/services/switch/turn_on"
        responce = requests.post(url,data=data,headers=headers)

obviously token and entity_ids are retrieved from separated files and are corrects.

The request post not give any error but it doesn’t turn on any lights.

The response of the script is this one (I have only 2 smart bulbs connected to HA):

<Response [200]>
<Response [200]>

Where am I Wrong?

light/turn_on ?

@koying Thank you!!! :smiley: :rofl: