mqtt-devices-parser 1.0.2 → 1.0.4

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,9 @@
1
+ # 1.0.4
2
+ - mqtt: adds retain to project state
3
+
4
+ # 1.0.3
5
+ - fixes config arg
6
+
1
7
  # 1.0.2
2
8
  - passes config struct por methods
3
9
 
package/Release.md ADDED
@@ -0,0 +1,11 @@
1
+ # Release
2
+
3
+ ## Before release
4
+
5
+ increases version on package.json
6
+ edit changelog
7
+ commit and push to repo
8
+
9
+ ## Releasing
10
+
11
+ npm publish
package/index.js CHANGED
@@ -32,11 +32,11 @@ var self = module.exports = {
32
32
  if(_projects != null)
33
33
  projects = _projects;
34
34
 
35
- await $.models.init(_config);
35
+ await $.models.init($.config);
36
36
  await $.models.connect();
37
37
 
38
38
  //auth.init();
39
- await $.device.init(_config,projects);
39
+ await $.device.init($.config,projects);
40
40
 
41
41
  console.log("mqtt connecting..")
42
42
  mqtt_connect();
@@ -82,7 +82,7 @@ var self = module.exports = {
82
82
  if(_config != null)
83
83
  $.config = _config;
84
84
 
85
- await $.models.init();
85
+ await $.models.init($.config);
86
86
  await $.models.connect();
87
87
 
88
88
  //main tables
@@ -136,9 +136,9 @@ function mqtt_connect(){
136
136
 
137
137
  for(let project in $.config.projects){
138
138
  if($.config.projects[project])
139
- client.publish(mqtt_prefix+"/"+project,"active");
139
+ client.publish(mqtt_prefix+"/"+project,"active",{qos:2,retain:true});
140
140
  else
141
- client.publish(mqtt_prefix+"/"+project,"deactive");
141
+ client.publish(mqtt_prefix+"/"+project,"deactive",{qos:2,retain:true});
142
142
  };
143
143
  })
144
144
  console.log(`MQTT connected to: ${$.config.mqtt.host}:${$.config.mqtt.port}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mqtt-devices-parser",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {