How do I use a random number helper in an automation

Hello all,

I have a light entity in home assistant that ranges from 1-255 (I have created a random number helper for this range). I am trying to create an automation that whenever presence is detected in the room, it uses the random number generated from the helper and sets the light entity at that value. This is my current YAML:

device_id: xxxxxxxxx
domain: number
entity_id: yyyyyyyyy
type: set_value
value: "{{ states('sensor.bedroom_light_switch_random_number') | float(0) }}"

I feel like I have tried every option under the sun but I continue to get the same, “Message malformed: expected float for dictionary value @ data[‘value’]” error message. I have tested the value line within the template section of the developer tools and it returns the appropriate value. Does anyone have an idea on how to fix this?

Device actions do not support templates. Why and how to avoid device_ids in automations and scripts