0

Can someone give me a tip what I am doing wrong with scheduling the actuator agent in my agent code to scrape some BACnet data?

    _now = get_aware_utc_now()
    str_start = format_timestamp(_now)
    _end = _now + td(seconds=10)
    str_end = format_timestamp(_end)
    peroidic_schedule_request = ["slipstream_internal/slipstream_hq/1100", # AHU
                                "slipstream_internal/slipstream_hq/5231", # eGuage Main
                                "slipstream_internal/slipstream_hq/5232", # eGuage RTU
                                "slipstream_internal/slipstream_hq/5240"] # eGuage PV

    # send the request to the actuator
    result = self.vip.rpc.call('platform.actuator', 'request_new_schedule', self.core.identity, 'my_schedule', 'HIGH', peroidic_schedule_request).get(timeout=90)
    _log.debug(f'[Conninuous Roller Agent INFO] - ACTUATOR SCHEDULE EVENT SUCESS {result}')

    meter_data_to_get = [self.ahu_clg_pid_topic,self.kw_pv_topic,self.kw_rtu_topic,self.kw_main_topic]
    rpc_result = self.vip.rpc.call('platform.actuator', 'get_multiple_points', meter_data_to_get).get(timeout=90)
    _log.debug(f'[Conninuous Roller Agent INFO] - kW data is {rpc_result}!')

The RPC request is working, I can get the data but there is an actuator agent error.

{'result': 'FAILURE', 'data': {}, 'info': 'MALFORMED_REQUEST: ValueError: too many values to unpack (expected 3)'}

Full Traceback:

2021-09-13 20:47:23,334 (actuatoragent-1.0 1477601) __main__ ERROR: bad request: {'time': '2021-09-13T20:47:23.334762+00:00', 'requesterID': 'platform.continuousroller', 'taskID': 'my_schedule', 'type': 'NEW_SCHEDULE'}, [], too many values to unpack (expected 3)
2021-09-13 20:47:23,338 (continuousrolleragent-0.1 1559787) __main__ DEBUG: [Conninuous Roller Agent INFO] - ACTUATOR SCHEDULE EVENT SUCESS {'result': 'FAILURE', 'data': {}, 'info': 'MALFORMED_REQUEST: ValueError: too many values to unpack (expected 3)'}
2021-09-13 20:47:23,346 (forwarderagent-5.1 1548751) __main__ DEBUG: publish_to_historian number of items: 1
2021-09-13 20:47:23,346 (forwarderagent-5.1 1548751) __main__ DEBUG: Lasttime: 0 currenttime: 1631566043.0
2021-09-13 20:47:23,350 (forwarderagent-5.1 1548751) __main__ DEBUG: handled: 1 number of items
2021-09-13 20:47:23,710 (continuousrolleragent-0.1 1559787) __main__ DEBUG: [Conninuous Roller Agent INFO] - kW data is [{'slipstream_internal/slipstream_hq/1100/Cooling Capacity Status': 76.46278381347656, 'slipstream_internal/slipstream_hq/5231/REGCHG total_power': 59960.0, 'slipstream_internal/slipstream_hq/5232/REGCHG total_rtu_power': 44507.0, 'slipstream_internal/slipstream_hq/5240/REGCHG Generation': 1477.0}, {}]!
bbartling
  • 3,288
  • 9
  • 43
  • 88

1 Answers1

0

I suspect that the the Scheduler, which is an attribute of Actuator, encounters a problem when creating a Task from the 'requests' object, which originates from the 'requests' parameter for 'request_new_schedule'. In your case, 'requests' is the list of strings in the object named 'periodic_schedule_request'. Creating a Task is part of the Actuator's workflow by dint of the Acutuator's Scheduler calling 'request_slots'; see https://github.com/VOLTTRON/volttron/blob/develop/services/core/ActuatorAgent/actuator/agent.py#L1378 and https://github.com/VOLTTRON/volttron/blob/a7bbdfcd4c82544bd743532891389f49b771b196/services/core/ActuatorAgent/actuator/scheduler.py#L392

When a Task is created, the 'requests' object is processed in the Task constructor method; see https://github.com/VOLTTRON/volttron/blob/a7bbdfcd4c82544bd743532891389f49b771b196/services/core/ActuatorAgent/actuator/scheduler.py#L148

I suspect that each 'request' in 'requests' is not an object composed of exactly three objects, potentially being the cause of the Actuator error. But I could be wrong. To know exactly what 'requests' looks like, go back through your logs and look for a debug statement from the Actuator that begins with: "Got new schedule request: ..." (see https://github.com/VOLTTRON/volttron/blob/develop/services/core/ActuatorAgent/actuator/agent.py#L1375)

Without seeing more of the logs, as a first step, I'd recommend verifying that the 'requests' object was properly processed; I'd also recommend putting various debug statements, especially at https://github.com/VOLTTRON/volttron/blob/a7bbdfcd4c82544bd743532891389f49b771b196/services/core/ActuatorAgent/actuator/scheduler.py#L148 to catch where this ValueError is coming from.

bonicim
  • 61
  • 2