"Invalid tag" when creating a new device

Hello,
I am trying to create a device from an external python script. As long as I don’t input any tags the creation of the device works fine. However when trying to create the device with some tags I get as a result:

{‘status’: False, ‘message’: ‘Invalid tag’}

and the device is not created.

This is my code:

new_device = {
“name”: self.id,
“description”: “Dispositivo tipo solar”,
“active”: True,
“visible”: True,
“tags”: [{“CP type”: “Solar”}]
}
result = tago_account.devices.create(new_device)

What is the problem here?
Thanks!

hi @velo-energy,

Your tags must be an array of object with key and value.
E.g:
[
{ key: “your_tag_name”, value: “your_tag_value” }
]

So, your tags are wrong, the right way is [{ key: “CP type”, value: “Solar” }]

2 Likes

You are right, thank you!!

1 Like