sql_app: fixed error while setting door state
Old code was taking state from device itself, meaning it never changes. Now it is set from the incoming request. Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
		
							parent
							
								
									dcd2ff5b89
								
							
						
					
					
						commit
						21d72f17b2
					
				| @ -382,11 +382,12 @@ def polling_method_for_iot_entity(request: schemas.IotDoorPollingRequest, | |||||||
|                                                 open_command=device.open_request, |                                                 open_command=device.open_request, | ||||||
|                                                 acces_list_counter=device.acces_list_counter, |                                                 acces_list_counter=device.acces_list_counter, | ||||||
|                                                 time_seconds=device.time_seconds, |                                                 time_seconds=device.time_seconds, | ||||||
|                                                 force_close=device.force_close) |                                                 force_close=device.force_close, | ||||||
|  |                                                 state=device.state) | ||||||
|     # Reset open_request to False |     # Reset open_request to False | ||||||
|     crud.clear_open_door_request(db, device.id) |     crud.clear_open_door_request(db, device.id) | ||||||
|     crud.clear_close_door_request(db, device.id) |     crud.clear_close_door_request(db, device.id) | ||||||
|     crud.set_door_state(db, device, device.state) |     crud.set_door_state(db, device, bool(request.state)) | ||||||
| 
 | 
 | ||||||
|     return response |     return response | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -104,6 +104,7 @@ class IotDoorPollingResponse(BaseModel): | |||||||
|     acces_list_counter : int |     acces_list_counter : int | ||||||
|     time_seconds : int |     time_seconds : int | ||||||
|     force_close: bool |     force_close: bool | ||||||
|  |     state: bool | ||||||
| 
 | 
 | ||||||
| class IotMonitorRoomInfo(BaseModel): | class IotMonitorRoomInfo(BaseModel): | ||||||
|     humidity : int |     humidity : int | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user