This module provides a sensor that reports whether the current time falls within a configured time range. It is designed to pair with a viam-server maintenance window, so that configuration changes are only applied during a time range you choose.
This module provides the following model(s):
viam:maintenance:time-allowed— a sensor whoseReadingsreturnis_allowed: truewhen the current local time is within a configured start/end window, andfalseotherwise. Overnight windows (e.g.22:00–06:00) are supported.
Configure the sensor on your machine, then point the machine's maintenance block at it:
{
"components": [
{
"name": "allowed-hours",
"api": "rdk:component:sensor",
"model": "viam:maintenance:time-allowed",
"attributes": {
"start_time": "08:00",
"end_time": "17:00",
"timezone": "America/New_York"
}
}
],
"maintenance": {
"sensor_name": "rdk:component:sensor/allowed-hours",
"maintenance_allowed_key": "is_allowed"
}
}With this configuration, viam-server will only apply configuration changes between 08:00 and 17:00 in the America/New_York timezone.