Returning the level/value of a LEDC component?

Hi, I’m using a speed fan component to control dc motor shades. Maybe this isn’t the proper way to do it, but I got everything working as expected when controlling the LEDC speed pin directly, i.e.

- lambda: !lambda |-
     id(speed_pin).set_level(id(motor_speed));

But I can’t figure out how to return the level in a lambda to check if the motor is on.

id(speed_pin).state doesn’t work, id(speed_pin).level, etc. .get_level() doesn’t exist either.

Any suggestions?
Thank you