because the first argument that’s required is an entity_id. You’re feeding it 'trigger.to_state’ which is not an entity_id. trigger.to_state is a state object. Take a look at this post to help you understand what a state object is:
'trigger.to_state