Automation Nexa switch

I am trying to create automation for my Nexa switch but am not succeeding very well.
It should be turned on at 5 p.m. or later at sunset (summer time), and turned off at 11 p.m.
I am using the latest version of Homeassistant.
I would really appreciate some help.