- # TODO get data from the config
- resp = Resp(imei=zmsg.imei, packet=msg.response())
+ if msg.RESPOND is not Respond.EXT:
+ log.error(
+ "%s does not expect externally provided response", msg
+ )
+ kwargs = {}
+ if isinstance(msg, STATUS):
+ kwargs = {
+ "upload_interval": termconfig.get(
+ "statusintervalminutes", 25
+ )
+ }
+ elif isinstance(msg, SETUP):
+ for key in (
+ "uploadintervalseconds",
+ "binaryswitch",
+ "alarms",
+ "dndtimeswitch",
+ "dndtimes",
+ "gpstimeswitch",
+ "gpstimestart",
+ "gpstimestop",
+ "phonenumbers",
+ ):
+ if key in termconfig:
+ kwargs[key] = termconfig[key]
+ resp = Resp(
+ imei=zmsg.imei, when=zmsg.when, packet=msg.Out(**kwargs).packed
+ )