Random option from Zigbee device

Hello all,

I have an automation which plays a melody on a zigbee sirene when the doorbell button is pressed.
The melody is a number from a option list from 1 to 18. In the example below the selected melody is 3.

How can I select a random option from this list when the doorbell is activated?

device_id: 387caf78db0e33ac00fe3e3a0ff2201e
domain: select
entity_id: select.sirene_hal_melody
type: select_option
option: "3"

Any pointers in the right direction are welcome.

Not tested

option: "{{ range(1, 18) | random }}"

Thanks for you reply.
Unfortunately this gives me the error thath the value {{ range(1, 18) | random }} is not valid.
I did use the double quotes around the function.

Dunno then, I don’t have the same device as you - the entry below has been tested and works to randomly change the value of an input select. Maybe that can help you work it out.

service: input_select.select_option
data:
  option: "{{ range(1, 18) | random }}"
target:
  entity_id: input_select.temporary