How to set cluster attribute. Works from gui not from service

I am trying to control my danfoss ally by setting the value of its attributes. I can successfully update the

Attribute ID = 0x4003 External Open Window Detected
     0x00: Windows are closed
     0x01: Windows are opened

Under

Cluster = 0x0201 

Using the gui
Screenshot 2021-01-13 at 19.11.07
Screenshot 2021-01-13 at 19.11.29

However when I try to convert it to a service call

service: zha.set_zigbee_cluster_attribute
service data:
  ieee: '84:2e:14:aa:bb:cc:eb:c0'
  endpoint_id: 1  
  cluster_id: 513
  attribute: 16387
  cluster_type: out
  value: 1
  manufacturer: '4678'

I tried putting all the numbers inside ping e.g. ‘1’ without success
I get an error ‘Failed to call service zha/set_zigbee_cluster_attribute. 513’

How can I convert the succesfull gui command into a working service call?

Figured it out :slight_smile: Cluster type has to be in

For others the full script is

alias: bad_term_close_window
sequence:
  - service: zha.set_zigbee_cluster_attribute
    data:
      ieee: '84:2e:14:aa:bb:cc:eb:c0'
      endpoint_id: 1
      cluster_id: 513
      attribute: 16387
      cluster_type: in
      value: 0
      manufacturer: '4678'
mode: single

Value = 0 means closed
Value = 1 means open