Пример #1
0
def online_evt(device, message):
    result = DeviceEventModel.online(device=device, message=message)
    if result:
        ip = message['clientIp']
        online_time = message['lastTime']
        ding_alert(f'{device} 上线 IP: {ip}  [{online_time}]')
    return
Пример #2
0
def error_evt(device, message):
    """
    协议解析错误
    """
    ding_alert(f'{device} 协议错误: {message}')

    # Todo 记录错误消息
    return
Пример #3
0
def reboot_evt(device, message):
    ding_alert(f'{device} 重启: {message}')
    return
Пример #4
0
def script_query_evt(device, message):
    DeviceEventModel.update_attr(device=device, message=message)

    ding_alert(f'{device} 查询设备脚本: {message}')
    return
Пример #5
0
def attr_set_evt(device, message):
    DeviceEventModel.update_attr(device=device, message=message)

    ding_alert(f'{device} 设置设备属性: {message}')
    return
Пример #6
0
def state_query_evt(device, message):
    DeviceEventModel.update_state(device=device, message=message)

    ding_alert(f'{device} 查询设备状态: {message}')
    return
Пример #7
0
def state_report_evt(device, message):
    DeviceEventModel.update_state(device=device, message=message)

    ding_alert(f'{device} 上报设备状态: {message}')
    return
Пример #8
0
def upgrade_evt(device, message):
    ding_alert(f'{device} 升级: {message}')
    return
Пример #9
0
def offline_evt(device, message):
    result = DeviceEventModel.offline(device=device, message=message)
    if result:
        offline_time = message['lastTime']
        ding_alert(f'{device} 离线  [{offline_time}]')
    return