-
Notifications
You must be signed in to change notification settings - Fork 3
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
TTN MQTT & device management (#8) #13
base: develop
Are you sure you want to change the base?
Conversation
closes #12
Now using Error subclasses to separate different response types instead of a homebrew `err.code` check. This allows to move the selection of errortype from the calling promise chain to the throwing function, improving consistency and readability.
TODO: authentication. right now theres an IP whitelist. proper authentication would allow queries directly from the oSeM frontend, which would provide a smoother integration in the end..
const p = box.integrations.ttn.port; | ||
|
||
return (p === port || p === undefined); | ||
})[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The app_id
and dev_id
are not enforced to be unique on the model schema. You should add the requirement to the main project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, the app_id, dev_id, port
tuple is assumed to be unique..
lib/ttn.js
Outdated
const log = createLogger('ttn'); | ||
|
||
const onUplinkMessage = function onUplinkMessage (dev_id, message) { | ||
const { app_id, port } = message; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate code to the httpIntegrationHandler
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because the response handling is different & I wanted to have different loggers for each protocol, and I didn't consider 10 duplicated lines to be worth an additional abstraction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok :)
Just pushed a docker image of this branch to |
Running the image results in a
|
I have this dependency in See TheThingsArchive/node-app-sdk@e1eca3f, it seems the babel people (™) have messed with semver or something. |
Also, I can finally test this with actual LoRa hardware in the next days. Will add end-to-end tests then |
Very good!
|
removes need to set the dev_id at all for mqtt boxes
@ubergesundheit Hey, this is ready, implementation wise. If required I can add comprehensive documentation on the required changes, a short list is in the TODO at the top of this PR already. |
Alright! Are there any changes to the angular app needed? |
yeah. the user should be able to select between his own TTN device with http integration (current solution), or the auto-creation of a device with our application. |
alternatively, a full integration with a Lora sketch containing the Lora keys comes to mind. |
With the new senseBox MCU in the pipeline, a LoRa Bee addon is planned. The generation of a full working sketch should be possible then. |
implements the feature that was suggested in #8.
Also featuring a rewrite of error handling code
Things to consider (@ubergesundheit):
TODO
box.integrations.ttn.dev_eui
, makeapp_id, dev_id, port
tuple uniqueGET ttnintegration/v1.1/ttndevice/:boxId
atPUT & POST mainapi/boxes/:boxId
handler