Not an automation expert (as I do all this in Node Red) but this should work:
Set action to “Call service”, service to “Light: turn on”, add your target entity, switch to YAML mode (three dot menu) and add a data_template: block that sets the brightness: data parameter with a template that references the state of your rotary switch entity.
Should be something like:
action:
service: light.turn_on
entity_id: light.office_light
data_template:
brightness: >
{{ states('sensor.rotary_encoder_3')|int }}
Also see this posting: