Class HighLoadTimeslot
- java.lang.Object
-
- io.openems.edge.common.component.AbstractOpenemsComponent
-
- io.openems.edge.controller.highloadtimeslot.HighLoadTimeslot
-
- All Implemented Interfaces:
OpenemsComponent
,Controller
public class HighLoadTimeslot extends AbstractOpenemsComponent implements Controller, OpenemsComponent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HighLoadTimeslot.ChannelId
-
Field Summary
Fields Modifier and Type Field Description protected ComponentManager
componentManager
static java.lang.String
DATE_FORMAT
static java.lang.String
TIME_FORMAT
-
Constructor Summary
Constructors Constructor Description HighLoadTimeslot()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.time.LocalDate
convertDate(java.lang.String date)
Converts a string to a LocalDate.protected static java.time.LocalTime
convertTime(java.lang.String time)
Converts a string to a LocalTime.protected void
deactivate()
Handles @Deactivate of implementations.protected static boolean
isActiveDate(java.time.LocalDate startDate, java.time.LocalDate endDate, java.time.LocalDateTime dateTime)
protected static boolean
isActiveTime(java.time.LocalTime startTime, java.time.LocalTime endTime, java.time.LocalDateTime dateTime)
Is the time of 'dateTime' within startTime and endTime?.protected static boolean
isActiveWeekday(WeekdayFilter activeDayFilter, java.time.LocalDateTime dateTime)
Is 'dateTime' within the ActiveWeekdayFilter?.protected static boolean
isWeekend(java.time.LocalDateTime dateTime)
Is 'dateTime' a Saturday or Sunday?.void
run()
Executes the Controller logic.-
Methods inherited from class io.openems.edge.common.component.AbstractOpenemsComponent
_channel, activate, activate, addChannel, addChannels, addChannels, alias, channels, getComponentContext, id, isEnabled, logDebug, logError, logInfo, logWarn, modified, removeChannel
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.openems.edge.controller.api.Controller
_setRunFailed, getRunFailed, getRunFailedChannel
-
Methods inherited from interface io.openems.edge.common.component.OpenemsComponent
_channel, _getChannelAs, alias, channel, channel, channels, debugLog, getComponentContext, getState, getStateChannel, hasFaults, id, isEnabled, serviceFactoryPid, servicePid
-
-
-
-
Field Detail
-
TIME_FORMAT
public static final java.lang.String TIME_FORMAT
- See Also:
- Constant Field Values
-
DATE_FORMAT
public static final java.lang.String DATE_FORMAT
- See Also:
- Constant Field Values
-
componentManager
protected ComponentManager componentManager
-
-
Method Detail
-
deactivate
protected void deactivate()
Description copied from class:AbstractOpenemsComponent
Handles @Deactivate of implementations. Prints log output.- Overrides:
deactivate
in classAbstractOpenemsComponent
-
run
public void run() throws OpenemsError.OpenemsNamedException
Description copied from interface:Controller
Executes the Controller logic.- Specified by:
run
in interfaceController
- Throws:
OpenemsError.OpenemsNamedException
- on error
-
isActiveWeekday
protected static boolean isActiveWeekday(WeekdayFilter activeDayFilter, java.time.LocalDateTime dateTime)
Is 'dateTime' within the ActiveWeekdayFilter?.- Parameters:
activeDayFilter
- theWeekdayFilter
dateTime
- the currentLocalDateTime
- Returns:
- true on yes
-
isActiveDate
protected static boolean isActiveDate(java.time.LocalDate startDate, java.time.LocalDate endDate, java.time.LocalDateTime dateTime)
-
isActiveTime
protected static boolean isActiveTime(java.time.LocalTime startTime, java.time.LocalTime endTime, java.time.LocalDateTime dateTime)
Is the time of 'dateTime' within startTime and endTime?.- Parameters:
startTime
- the configured start timeendTime
- the configured end timedateTime
- the currentLocalDateTime
- Returns:
- true on yes
-
convertDate
protected static java.time.LocalDate convertDate(java.lang.String date)
Converts a string to a LocalDate.- Parameters:
date
- the string- Returns:
- a
LocalDate
object
-
convertTime
protected static java.time.LocalTime convertTime(java.lang.String time)
Converts a string to a LocalTime.- Parameters:
time
- the string- Returns:
- a
LocalTime
object
-
isWeekend
protected static boolean isWeekend(java.time.LocalDateTime dateTime)
Is 'dateTime' a Saturday or Sunday?.- Parameters:
dateTime
- the currentLocalDateTime
- Returns:
- true on yes
-
-