Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Django: Send data to devices via admin dashboard #27

Merged
merged 4 commits into from
Jun 4, 2024

Conversation

jonas-rem
Copy link
Member

@jonas-rem jonas-rem commented May 27, 2024

Add the capability to send messages to devices from the django dashboard. Once a DeviceOperation Resource gets

  • Assign Leshan URI automatically, depending on if running in container or locally
  • Add initial resources to the database on initial django start (Static LwM2M Resources)
  • DeviceOperations resource read-only from the admin dashboard
  • Setup all relevant resources as read-only from the admin dashboard

Note: this initial feature set only works for non-queue mode (devices always online). Queued mode requires more work on thee Leshan->Django interfaces so that Leshan updates Django on the current device status (online/offline).

Fixes: #13

@jonas-rem jonas-rem self-assigned this May 27, 2024
@jonas-rem jonas-rem force-pushed the WIP/jonas-rem/bidir_comm branch 2 times, most recently from 6da1197 to acf9a4a Compare May 27, 2024 21:35
@jonas-rem jonas-rem marked this pull request as ready for review May 27, 2024 22:09
@jonas-rem jonas-rem mentioned this pull request May 27, 2024
3 tasks
@jonas-rem jonas-rem marked this pull request as draft May 27, 2024 22:48
@jonas-rem jonas-rem marked this pull request as ready for review May 27, 2024 22:48
Copy link
Collaborator

@Kappuccino111 Kappuccino111 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonas-rem, this primarily revolves around the initial setup of DeviceOperations and communication from the Django backend to the device endpoint. Seems good to go 👍.

Django needs to know how to reach leshan. This can be either
http://0.0.0.0 or http://leshan depending if the server runs locally or
in docker. Django reads the env variable and assigns either.

Signed-off-by: Jonas Remmert <jremmert@gmx.net>
When a DeviceOperation gets saves (added or changed) django triggers a
ReST api call to Leshan to send that resource. Depending on whether that
was successfull, it updates the fields "status, Retransmit counter".

Limitation: Works only for non-queue mode for now. Rest api gets called
synchronously.

Signed-off-by: Jonas Remmert <jremmert@gmx.net>
Signed-off-by: Jonas Remmert <jremmert@gmx.net>
Signed-off-by: Jonas Remmert <jremmert@gmx.net>
@jonas-rem jonas-rem merged commit 7457f5a into main Jun 4, 2024
2 checks passed
@jonas-rem jonas-rem deleted the WIP/jonas-rem/bidir_comm branch June 4, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Django: Bidirectional communication example
2 participants