There are probably a couple of ways to get this to work, but honestly the easiest way is to use switches that are natively compatible with HE (which are usually not wifi) and use a basic rule or the room lighting app to do it.
If you want to try something to make use of your current Sonoff switch (not really what I recommend) you could:
(1) See if someone has written an interface for this Sonoff switch. If there is an open API someone might have done it. If there is and you can control the Sonoff switch directly from Hubitat something like the basic automation app would work. Your best bet is to search the forums here. I did find a couple of references to switches but not sure if there's actually a working integration.
(2) You could expose your HE motion sensor to Alexa and create a routine using Alexa. I'm not sure Alexa's routines have enough flexibility to do this easily, though. You might have to create a rule on HE that only enabled the motion sensor between sunset and sunrise, and then a corresponding routine on Alexa that used the motion sensor to turn the switch on and off. While this would likely work it would definitely be a chewing gum and duct tape solution and there might be a delay turning on the light. It would also be a pain to troubleshoot.
Once you get to the next version of your rule / automation, if you still need help, many (like me) find it useful to also see a screenshot of your automation, e.g. a rule in Rule Machine.
Step two: create rule that turn on virtual switch after sunset via motion sensor attached to hubitat
Step 3: Expose virtual switch to echo integration on hubitat so that alexa sees it
Step 4: create routine on alexa that turns on your sonoff wifi switch when it sees the virtual switch turned on and turns off when the virtual switch is turned off.
You can test by going to the rule on hubitat and clicking Run Actions (Your after sunset trigger should be on hubitat and not alexa). Doinig the run action bypasses the trigger and makes sure it's running ok. So run action, that should turn on the virtual switch and alexa should do it's thing
From what I can find doing a quick perusal of the web, Sonoff provide a documented REST api for local control of some of their devices. Much good information to be found at:
and
So, while it's a bit of a janky way of doing things, you could just send the appropriate http:// requests directly from Rule Machine. Horribly ugly, but it will get the job done. A vastly better solution would be to craft a switch driver so HE can properly access it, but at the current time I'm not sure I know HE well enough to try doing that.