Door lock does not report the correct state in smarthome_exec method
mealgi opened this issue · 0 comments
Describe the bug:
DoorLock device does not report correct state which causes an error vhen activated from Google Assistant
it currently reports 'lock' : True or 'lock' : False to the self.report_state(devices, token) in smarthome_exec method
Expected behavior:
it should report 'isLocked' : True or 'isLocked' : False to the self.report_state(devices, token) in smarthome_exec method
Logs:
Desktop (please complete the following information):
Context :
Version: 2024.2 (build 15866)
Build Hash: d7e442ae0-modified
Compile Date: 2024-01-20 16:18:19
dzVents Version: 3.1.8
Python Version: 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110]
DZGA version 1.23.12
Smartphone (please complete the following information):
- Device: iPhone6
Additional context, screenshot:
Proposed solution:
Replace line 1128 in smarthome.py
if state.report_state == True and enableReport == True:
devices[entity_id] = execution.get('params', {})
devices[entity_id].update({'online': True})
if 'followUpToken' in devices[entity_id]:
devices[entity_id].pop('followUpToken')
self.report_state(devices, token)
by
if state.report_state == True and enableReport == True:
devices[entity_id] = execution.get('params', {})
DeviceState={}
if 'DoorLock' in entity_id:
DeviceState[entity_id]={}
if devices[entity_id]['lock']==True:
DeviceState[entity_id]['isLocked']=True
else:
DeviceState[entity_id]['isLocked']=False
DeviceState[entity_id].update({'online': True})
self.report_state(DeviceState, token)
else:
devices[entity_id].update({'online': True})
if 'followUpToken' in devices[entity_id]:
devices[entity_id].pop('followUpToken')
self.report_state(devices, token)