You can trigger an automation from a sensor with device_class: timestamp: Automation Trigger - Home Assistant
Create two sensors from your data for start and end time, and two simple automations for turn-on and turn-off. Come back with code if you need further help.
This might be of interest, too: Octopus Energy Agile Tariff - #22 by badguy