mqtt-devices-parser 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Changelog.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 1.0.6
2
+ - device: updates project if mismatch
3
+
1
4
  # 1.0.5
2
5
  - db: adds mqtt user passed on mqtt struct and grants admin privileges
3
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mqtt-devices-parser",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -62,11 +62,11 @@ var self = module.exports = {
62
62
  .catch( (err) => {});
63
63
  }
64
64
 
65
- if(device?.project_id == null){
66
- let res = await $.db_project.getByName(project_name);
67
- let project_id = res?.id;
68
- if(project_id != null) $.db_device.updateProject(uid,project_id);
69
- }
65
+ // update project id if needed
66
+ let res = await $.db_project.getByName(project_name);
67
+ let project_id = res?.id;
68
+ if(project_id != null && project_id != device?.project_id)
69
+ $.db_device.updateProject(uid,project_id);
70
70
 
71
71
  if(topic.endsWith("status")){
72
72
  if(payload == "online" || payload == "offline")