Your wiring works, but with the downside that if the wall switch is set to off your Shelly won’t even be visible in the App and the fan, hence, can’t be switched on remotely.
You could instead connect the Shelly with both N and L of the supply terminals from the switch and connect the L from the Load terminal to SW. That way the Shelly is online irrespective of the switch position, you could always switch the fan on or off via app and you could still use your wall switch to operate the fan. Set Button type to toggle or edge on that case. Disadvantage: The red marker of the wall switch will not necessarily be reliably tell you if the fan is on or off anymore (as it may be in the off position but you’ve switched the fan on via app - or Vice versa), and I don’t know the regulation in your region.
Hope that helps you find the right wiring for you.
Best
Georg