membermatters / MemberMatters

An open source membership, access and payments portal for makerspaces and community groups.
https://membermatters.org
MIT License
40 stars 23 forks source link

Allow doors to be created via the admin panel #213

Closed proffalken closed 9 months ago

proffalken commented 10 months ago

Fixes #210

This is may not be the best way to fix this, but it allows the creation of doors via the Django Admin interface.

Once they have been created, the platform works for connection from the Mainboard-firmware, however there is still an error produced by https://github.com/membermatters/MemberMatters/blob/main/memberportal/api_access/consumers.py#L60 so we probably need to put some better error handling in there at some point.

Sample logs with these changes in place:

System check identified no issues (0 silenced).
September 05, 2023 - 05:40:17
Django version 3.2.21, using settings 'membermatters.settings'
Starting ASGI/Channels version 3.0.5 development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.

2023-09-05 05:40:23,070 app INFO     Door connected!
<MAC_ADDR>
2023-09-05 05:40:23,225 app INFO     Got message from door (2): {'api_secret_key': '<SECRET>'}

2023-09-05 05:40:23,249 app INFO     Received an authorisation packet from <MAC_ADDR>
2023-09-05 05:40:23,250 app INFO     Authorisation successful from <MAC_ADDR>
2023-09-05 05:40:23,252 app INFO     Syncing door <MAC_ADDR>
2023-09-05 05:40:23,253 app INFO     Updating update_door_locked_out for door <MAC_ADDR>
2023-09-05 05:40:23,256 app INFO     Got message from door (2): {'command': 'ip_address', 'ip_address': '192.168.x.xxx'}
2023-09-05 05:40:33,192 app INFO     Got message from door (2): {'command': 'ping'}
2023-09-05 05:40:43,144 app INFO     Got message from door (2): {'command': 'ping'}
<QuerySet []>
2023-09-05 05:40:52,560 app INFO     Sending door bump to channels for door_<MAC_ADDR>
2023-09-05 05:40:52,561 app INFO     Sending door bump for <MAC_ADDR>
Sending door bump for <MAC_ADDR>
2023-09-05 05:40:56,984 app INFO     Sending door reboot to channels for door_<MAC_ADDR>
2023-09-05 05:40:56,987 app INFO     Rebooting door for <MAC_ADDR>
2023-09-05 05:41:03,009 app INFO     Got message from door (2): {'command': 'ping'}
<QuerySet []>
2023-09-05 05:41:08,847 app INFO     Got message from door (2): {'command': 'ping'}
2023-09-05 05:41:18,862 app INFO     Got message from door (2): {'command': 'ping'}
jabelone commented 9 months ago

Fixed in a recent commit. :)