From b8c0d1ad871d0148d2b8a5c5532d417045585578 Mon Sep 17 00:00:00 2001 From: sunjie Date: Sun, 11 Jan 2026 20:18:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E9=97=A8,=E5=85=B3=E9=97=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- attendance_iot/models/attendance_iot.py | 24 +++++++++++++++++++ attendance_iot/views/attendance_iot_views.xml | 2 ++ 2 files changed, 26 insertions(+) diff --git a/attendance_iot/models/attendance_iot.py b/attendance_iot/models/attendance_iot.py index 9171c514e..ba7b2f163 100644 --- a/attendance_iot/models/attendance_iot.py +++ b/attendance_iot/models/attendance_iot.py @@ -77,3 +77,27 @@ class AttendanceIot(models.Model): 'cmd': 'uploadFaceInfo' }, ensure_ascii=False) }]) + + # 发送开门信号 + def action_send_open_door_sigle(self): + for record in self: + self.env['iot.message'].create([{ + 'name': '开门', + 'topic': f'iot/device/{record.name}', + 'device_sn': record.name, + 'message_data': json.dumps({ + 'cmd': 'setDoor', + 'value': 'on' + }, ensure_ascii=False) + }]) + def action_send_close_door_sigle(self): + for record in self: + self.env['iot.message'].create([{ + 'name': '开门', + 'topic': f'iot/device/{record.name}', + 'device_sn': record.name, + 'message_data': json.dumps({ + 'cmd': 'setDoor', + 'value': 'off' + }, ensure_ascii=False) + }]) diff --git a/attendance_iot/views/attendance_iot_views.xml b/attendance_iot/views/attendance_iot_views.xml index 3ebfad327..a213fb04e 100644 --- a/attendance_iot/views/attendance_iot_views.xml +++ b/attendance_iot/views/attendance_iot_views.xml @@ -18,6 +18,8 @@