From 575dfedd0e859ffd02b5314dbb278e0c57ea066f Mon Sep 17 00:00:00 2001 From: chaveiro Date: Tue, 14 Sep 2021 17:57:32 +0100 Subject: [PATCH 1/6] Bug fix Fix the follow: - missing check for redis when generating device key - generate a key prior to save, instead of generate on the fly - added device menu for accessing the (previously hidden) devices/view page and allow to create new devices manually. - Added a few tasmota device support --- Views/device.js | 11 +- Views/device_dialog.js | 18 ++-- data/Gtronica/AirSensor.json | 124 ++++++++++++++++++++++ data/Gtronica/PowerMeter.json | 182 +++++++++++++++++++++++++++++++++ data/Gtronica/SensorSolar.json | 127 +++++++++++++++++++++++ data/Gtronica/Sensornode.json | 125 ++++++++++++++++++++++ device_controller.php | 5 +- device_menu.php | 16 +-- device_model.php | 21 ++-- module.json | 2 +- 10 files changed, 599 insertions(+), 32 deletions(-) create mode 100644 data/Gtronica/AirSensor.json create mode 100644 data/Gtronica/PowerMeter.json create mode 100644 data/Gtronica/SensorSolar.json create mode 100644 data/Gtronica/Sensornode.json diff --git a/Views/device.js b/Views/device.js index 3416e85..3c6d289 100644 --- a/Views/device.js +++ b/Views/device.js @@ -16,22 +16,25 @@ var device = { $.ajax({ url: path+"device/set.json", data: "id="+id+"&fields="+JSON.stringify(fields), async: false, success: function(data) {result = data;} }); return result; }, - + 'generatekey':function(id) { + var result = {}; + $.ajax({ url: path+"device/generatekey.json", async: false, success: function(data) {result = data;} }); + return result; + }, 'setNewDeviceKey':function(id) { var result = {}; $.ajax({ url: path+"device/setnewdevicekey.json", data: "id="+id, async: false, success: function(data) {result = data;} }); return result; }, - 'remove':function(id) { var result = {}; $.ajax({ url: path+"device/delete.json", data: "id="+id, async: false, success: function(data) {result = data;} }); return result; }, - 'create':function(nodeid, name, description, type) { + 'create':function(nodeid, name, description, type, devicekey) { var result = {}; - $.ajax({ url: path+"device/create.json", data: "nodeid="+nodeid+"&name="+name+"&description="+description+"&type="+type, async: false, success: function(data) {result = data;} }); + $.ajax({ url: path+"device/create.json", data: "nodeid="+nodeid+"&name="+name+"&description="+description+"&type="+type+"&dkey="+devicekey, async: false, success: function(data) {result = data;} }); return result; }, diff --git a/Views/device_dialog.js b/Views/device_dialog.js index 1696423..6aede44 100644 --- a/Views/device_dialog.js +++ b/Views/device_dialog.js @@ -146,8 +146,7 @@ var device_dialog = $('#device-config-node').val(this.device.nodeid); $('#device-config-name').val(this.device.name); $('#device-config-description').val(this.device.description); - $('#device-config-devicekey').val(this.device.devicekey).prop("disabled", false); - $("#device-config-devicekey-new").prop("disabled", false); + $('#device-config-devicekey').val(this.device.devicekey); $('#device-delete').show(); $("#device-save").html("Save"); if (this.device.type != null && this.device.type != '') { @@ -163,8 +162,7 @@ var device_dialog = $('#device-config-node').val(''); $('#device-config-name').val(''); $('#device-config-description').val(''); - $('#device-config-devicekey').val('').prop("disabled", true); - $("#device-config-devicekey-new").prop("disabled", true); + $('#device-config-devicekey').val(''); $('#device-delete').hide(); $("#device-init").hide(); $("#device-save").html("Save & Initialize"); @@ -260,11 +258,10 @@ var device_dialog = alert('Unable to update device fields:\n'+result.message); return false; } - update(); } else { var type = device_dialog.deviceType; - var result = device.create(node, name, desc, type); + var result = device.create(node, name, desc, type, devicekey); if (typeof result.success !== 'undefined' && !result.success) { alert('Unable to create device:\n'+result.message); return false; @@ -278,13 +275,13 @@ var device_dialog = }; init = true; } - update(); } - $('#device-config-modal').modal('hide'); + update(); + $('#device-config-modal').modal('hide'); if (init) device_dialog.loadInit(); } else { - alert('Device needs to be configured first.'); + alert('Please give Node and Name.'); return false; } }); @@ -300,8 +297,7 @@ var device_dialog = }); $("#device-config-devicekey-new").off('click').on('click', function () { - device_dialog.device.devicekey = device.setNewDeviceKey(device_dialog.device.id); - $('#device-config-devicekey').val(device_dialog.device.devicekey); + $('#device-config-devicekey').val(device.generatekey(device_dialog.device.id)); }); }, diff --git a/data/Gtronica/AirSensor.json b/data/Gtronica/AirSensor.json new file mode 100644 index 0000000..0f6ea71 --- /dev/null +++ b/data/Gtronica/AirSensor.json @@ -0,0 +1,124 @@ +{ + "name": "AirSensor", + "category": "Gtronica", + "group": "Custom", + "description": "Automatic inputs and feeds creation for IKEA Vindriktning + BME280 with a Tasmota device inside and websend rules.", + "inputs": [ + { + "name": "T", + "description": "Temperature", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Temperature" + } + } + ] + }, + { + "name": "H", + "description": "Humidity", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Humidity" + } + } + ] + }, + { + "name": "P", + "description": "Pressure", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Pressure" + } + } + ] + }, + { + "name": "PM1", + "description": "PM1", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "PM1" + } + } + ] + }, + { + "name": "PM2", + "description": "PM2.5", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "PM2" + } + } + ] + }, + { + "name": "PM10", + "description": "PM10", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "PM10" + } + } + ] + } + ], + "feeds": [ + { + "name": "Temperature", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "ºC" + }, + { + "name": "Humidity", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "%" + }, + { + "name": "Pressure", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "hPa" + }, + { + "name": "PM1", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "µg/m³" + }, + { + "name": "PM2", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "µg/m³" + }, + { + "name": "PM10", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "µg/m³" + } + ] +} \ No newline at end of file diff --git a/data/Gtronica/PowerMeter.json b/data/Gtronica/PowerMeter.json new file mode 100644 index 0000000..c1f089c --- /dev/null +++ b/data/Gtronica/PowerMeter.json @@ -0,0 +1,182 @@ +{ + "name": "PowerMeter", + "category": "Gtronica", + "group": "Custom", + "description": "Automatic inputs and feeds creation for Hiking DDS238-2 WIFI Tasmota device and websend rules.", + "inputs": [ + { + "name": "P", + "description": "Power W", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Power" + } + } + ] + }, + { + "name": "I", + "description": "Current I", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Current" + } + } + ] + }, + { + "name": "V", + "description": "Voltage", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Voltage" + } + } + ] + }, + { + "name": "S", + "description": "Aparent Power", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Apparent" + } + } + ] + }, + { + "name": "Q", + "description": "Reactive Factor", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Reactive" + } + } + ] + }, + { + "name": "Pf", + "description": "Power Factor", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Factor" + } + } + ] + }, + { + "name": "Total", + "description": "Total", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Total" + } + } + ] + }, + { + "name": "Today", + "description": "Today", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Today" + } + } + ] + }, + { + "name": "Yesterday", + "description": "Yesterday", + "processList": [ + { + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "Yesterday" + } + } + ] + } + ], + "feeds": [ + { + "name": "Power", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5", + "unit": "W" + }, + { + "name": "Current", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "A" + }, + { + "name": "Voltage", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "V" + }, + { + "name": "Apparent", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "VA" + }, + { + "name": "Reactive", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "VAr" + }, + { + "name": "Factor", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "cosϕ" + }, + { + "name": "Total", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "kWh" + }, + { + "name": "Today", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "kWh" + }, + { + "name": "Yesterday", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "unit": "kWh" + } + ] +} diff --git a/data/Gtronica/SensorSolar.json b/data/Gtronica/SensorSolar.json new file mode 100644 index 0000000..5a532eb --- /dev/null +++ b/data/Gtronica/SensorSolar.json @@ -0,0 +1,127 @@ +{ "name": "SensorSolar", + "category": "Gtronica", + "group": "Custom", + "description": "Automatic inputs and feeds creation for gtronica.com Multi Sensors (Solar) device.", + "inputs": [ + { + "name": "T", + "description": "Temperature C", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "tempC" } + } + ] + }, + { + "name": "H", + "description": "Humidity Rh%", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "humiRH" } + } + ] + }, + { + "name": "T1", + "description": "Temp 1", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "T1" } + } + ] + }, { + "name": "T2", + "description": "Temp 2", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "T2" } + } + ] + }, { + "name": "T3", + "description": "Temp 3", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "T3" } + } + ] + }, { + "name": "T4", + "description": "Temp 4", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "T4" } + } + ] + }, { + "name": "T5", + "description": "Temp 5", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "T5" } + } + ] + }, + { + "name": "R", + "description": "Wifi RSSI", + "processList": [ + { + "process": "1", + "arguments": {"type": "ProcessArg::FEEDID", "value": "rssi" } + } + ] + } + ], + + "feeds": [ + { + "name": "tempC", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "humiRH", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "rssi", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "T1", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "T2", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "T3", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "T4", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + }, + { + "name": "T5", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL" + } + ] +} diff --git a/data/Gtronica/Sensornode.json b/data/Gtronica/Sensornode.json new file mode 100644 index 0000000..6a0048e --- /dev/null +++ b/data/Gtronica/Sensornode.json @@ -0,0 +1,125 @@ +{ + "name": "Sensor Node", + "category": "Gtronica", + "group": "Custom", + "description": "Automatic inputs and feeds creation for gtronica.com Sensor Node device.", + "inputs": [{ + "name": "1", + "description": "Temperature Internal C", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "tempIntC" + } + }] + }, + { + "name": "2", + "description": "Temperature DS C", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "tempExtC" + } + }] + }, + { + "name": "3", + "description": "Humidity Rh%", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "humiRH" + } + }] + }, + { + "name": "4", + "description": "Internal Battery", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "batV" + } + }] + }, + { + "name": "5", + "description": "Pulse Cnt", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "pulse" + } + }] + }, + { + "name": "6", + "description": "TX Power", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "txPower" + } + }] + }, + { + "name": "7", + "description": "RX RSSI", + "processList": [{ + "process": "log_to_feed", + "arguments": { + "type": "ProcessArg::FEEDID", + "value": "rssidBm" + } + }] + }], + "feeds": [{ + "name": "tempIntC", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "tempExtC", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "humiRH", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "batV", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "pulse", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "txPower", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }, + { + "name": "rssidBm", + "type": "DataType::REALTIME", + "engine": "Engine::MYSQL", + "interval": "5" + }] +} diff --git a/device_controller.php b/device_controller.php index aa31a26..970068f 100644 --- a/device_controller.php +++ b/device_controller.php @@ -65,12 +65,15 @@ function device_controller() if ($session['userid']>0 && $session['read']) $result = $device->get_list($session['userid']); } else if ($route->action == "create") { - if ($session['userid']>0 && $session['write']) $result = $device->create($session['userid'],get("nodeid"),get("name"),get("description"),get("type"),get("options")); + if ($session['userid']>0 && $session['write']) $result = $device->create($session['userid'],get("nodeid"),get("name"),get("description"),get("type"),get("dkey")); } // Used in conjunction with input name describe to auto create device else if ($route->action == "autocreate") { if ($session['userid']>0 && $session['write']) $result = $device->autocreate($session['userid'],get('nodeid'),get('type')); } + else if ($route->action == "generatekey") { + if ($session['userid']>0 && $session['write']) $result = $device->generate_devicekey(); + } else if ($route->action == "template" && $route->subaction != "prepare" && $route->subaction != "init") { if ($route->subaction == "listshort") { if ($session['userid']>0 && $session['write']) $result = $device->get_template_list_meta(); diff --git a/device_menu.php b/device_menu.php index 281e489..79d028c 100644 --- a/device_menu.php +++ b/device_menu.php @@ -1,8 +1,10 @@ _("Device Setup"), - 'path' => 'device/view', - 'icon' => 'device', - 'order' => 'b6' -);*/ +global $session; +if ($session["write"]) { + $menu["setup"]["l2"]['device'] = array( + "name"=>_("Devices"), + "href"=>"device/view", + "order"=>1, + "icon"=>"device" + ); +} \ No newline at end of file diff --git a/device_model.php b/device_model.php index 3b863e7..a2bf7b6 100644 --- a/device_model.php +++ b/device_model.php @@ -320,7 +320,7 @@ public function autocreate($userid, $_nodeid, $_type) { if (!$deviceid) { $this->log->info("Automatically create device for user=$userid, nodeid=$nodeid"); - $deviceid = $this->create($userid, $nodeid, null, null, null); + $deviceid = $this->create($userid, $nodeid, null, null, null, null); if (!$deviceid) return array("success"=>false, "message"=>"Device creation failed"); } @@ -332,7 +332,7 @@ public function autocreate($userid, $_nodeid, $_type) { } } - public function create($userid, $nodeid, $name, $description, $type) { + public function create($userid, $nodeid, $name, $description, $type, $devicekey = "") { $userid = intval($userid); $nodeid = preg_replace('/[^\p{L}_\p{N}\s\-:.]/u', '', $nodeid); @@ -355,9 +355,6 @@ public function create($userid, $nodeid, $name, $description, $type) { } if (!$this->exists_nodeid($userid, $nodeid)) { - // device key disabled by default - $devicekey = ""; - $stmt = $this->mysqli->prepare("INSERT INTO device (userid,nodeid,name,description,type,devicekey) VALUES (?,?,?,?,?,?)"); $stmt->bind_param("isssss",$userid,$nodeid,$name,$description,$type,$devicekey); $result = $stmt->execute(); @@ -532,7 +529,9 @@ public function set_fields($id, $fields) { $stmt = $this->mysqli->prepare("UPDATE device SET devicekey = ? WHERE id = ?"); $stmt->bind_param("si",$fields->devicekey,$id); if ($stmt->execute()) { - $this->redis->hSet("device:".$id,"devicekey",$fields->devicekey); + if ($this->redis) { + $this->redis->hSet("device:".$id,"devicekey",$fields->devicekey); + } } else $success = false; $stmt->close(); } @@ -544,6 +543,10 @@ public function set_fields($id, $fields) { } } + public function generate_devicekey() { + return generate_secure_key(16); + } + public function set_new_devicekey($id) { $id = intval($id); if (!$this->exist($id)) { @@ -552,7 +555,7 @@ public function set_new_devicekey($id) { } } - $devicekey = generate_secure_key(16); + $devicekey = $this->generate_devicekey(); $stmt = $this->mysqli->prepare("UPDATE device SET devicekey = ? WHERE id = ?"); $stmt->bind_param("si",$devicekey,$id); @@ -560,7 +563,9 @@ public function set_new_devicekey($id) { $stmt->close(); if ($result) { - $this->redis->hSet("device:".$id,"devicekey",$devicekey); + if ($this->redis) { + $this->redis->hSet("device:".$id,"devicekey",$devicekey); + } return $devicekey; } else { return false; diff --git a/module.json b/module.json index 8f4d7ce..2053569 100644 --- a/module.json +++ b/module.json @@ -1,6 +1,6 @@ { "name" : "Device", - "version" : "2.1.2", + "version" : "2.1.3", "location" : "/var/www/emoncms/Modules", "branches_available": ["stable","master"] } From 9d7e19b0a45fead29c019c547b89057ef7bc2e26 Mon Sep 17 00:00:00 2001 From: chaveiro Date: Tue, 14 Sep 2021 18:28:33 +0100 Subject: [PATCH 2/6] Update device_view.php Remove "Location " string from table grouping header. --- Views/device_view.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Views/device_view.php b/Views/device_view.php index e1413ab..890e98d 100644 --- a/Views/device_view.php +++ b/Views/device_view.php @@ -60,7 +60,7 @@ // Extend table library field types for (z in customtablefields) table.fieldtypes[z] = customtablefields[z]; table.element = "#table"; - table.groupprefix = "Location "; + table.groupprefix = ""; table.groupby = 'description'; table.groupfields = { 'dummy-4':{'title':'', 'type':"blank"}, From 7a437f69837a635f22f3c672203c558d75ee36a3 Mon Sep 17 00:00:00 2001 From: chaveiro Date: Wed, 15 Sep 2021 09:01:10 +0100 Subject: [PATCH 3/6] Update device_dialog.js --- Views/device_dialog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Views/device_dialog.js b/Views/device_dialog.js index 6aede44..1c75609 100644 --- a/Views/device_dialog.js +++ b/Views/device_dialog.js @@ -297,7 +297,7 @@ var device_dialog = }); $("#device-config-devicekey-new").off('click').on('click', function () { - $('#device-config-devicekey').val(device.generatekey(device_dialog.device.id)); + $('#device-config-devicekey').val(device.generatekey()); }); }, From 4769bdbec38853267ceba67df719ebc979dc4c22 Mon Sep 17 00:00:00 2001 From: chaveiro Date: Wed, 15 Sep 2021 10:12:24 +0100 Subject: [PATCH 4/6] Documentation update Fix typos and added better descriptions. --- Views/device_api.php | 8 +++++--- Views/device_view.php | 12 ++++++------ data/Gtronica/AirSensor.json | 2 +- data/Gtronica/PowerMeter.json | 2 +- data/Gtronica/SensorSolar.json | 2 +- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Views/device_api.php b/Views/device_api.php index 0b33ae5..e21f6dd 100644 --- a/Views/device_api.php +++ b/Views/device_api.php @@ -42,9 +42,11 @@ - + - + + +
device/list.json
device/get.json?id=1
device/create.json?nodeid=Test&name=Test
device/set.json?nodeid=Room&name=Test&description=House&type=test&dkey=DEVICEKEY
device/delete.json?id=1
device/set.json?id=1&fields={"name":"Test","description":"Room","nodeid":"House","type":"test"}
device/set.json?id=1&nodeid=Room&name=Test&description=House&type=test&dkey=DEVICEKEY
device/generatekey.json
device/setNewDeviceKey.json?id=1
device/init.json?id=1
@@ -60,7 +62,7 @@ device/template/listshort.json device/template/list.json device/template/reload.json - device/template/get.json?type=example + device/template/get.json?type=example device/template/prepare.json?id=1 diff --git a/Views/device_view.php b/Views/device_view.php index 890e98d..07df078 100644 --- a/Views/device_view.php +++ b/Views/device_view.php @@ -25,7 +25,7 @@
-

+

@@ -33,11 +33,11 @@


- +

- +
- +

@@ -48,8 +48,8 @@ - -
+ +
diff --git a/data/Gtronica/AirSensor.json b/data/Gtronica/AirSensor.json index 0f6ea71..f2460cd 100644 --- a/data/Gtronica/AirSensor.json +++ b/data/Gtronica/AirSensor.json @@ -1,5 +1,5 @@ { - "name": "AirSensor", + "name": "Air Sensor", "category": "Gtronica", "group": "Custom", "description": "Automatic inputs and feeds creation for IKEA Vindriktning + BME280 with a Tasmota device inside and websend rules.", diff --git a/data/Gtronica/PowerMeter.json b/data/Gtronica/PowerMeter.json index c1f089c..ac6832c 100644 --- a/data/Gtronica/PowerMeter.json +++ b/data/Gtronica/PowerMeter.json @@ -1,5 +1,5 @@ { - "name": "PowerMeter", + "name": "Power Meter", "category": "Gtronica", "group": "Custom", "description": "Automatic inputs and feeds creation for Hiking DDS238-2 WIFI Tasmota device and websend rules.", diff --git a/data/Gtronica/SensorSolar.json b/data/Gtronica/SensorSolar.json index 5a532eb..d886f80 100644 --- a/data/Gtronica/SensorSolar.json +++ b/data/Gtronica/SensorSolar.json @@ -1,4 +1,4 @@ -{ "name": "SensorSolar", +{ "name": "Sensor Solar", "category": "Gtronica", "group": "Custom", "description": "Automatic inputs and feeds creation for gtronica.com Multi Sensors (Solar) device.", From bc631aa25a70d46986e47e5be608bf6dc302b39a Mon Sep 17 00:00:00 2001 From: chaveiro Date: Wed, 15 Sep 2021 10:42:46 +0100 Subject: [PATCH 5/6] Update device_model.php Fix device last updated not working on sql engine. --- device_model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_model.php b/device_model.php index a2bf7b6..e579453 100644 --- a/device_model.php +++ b/device_model.php @@ -77,7 +77,7 @@ public function devicekey_session($devicekey) { $this->redis->hMset("device:lastvalue:$id", array('time' => $time)); } else { //$time = date("Y-n-j H:i:s", $time); - $this->mysqli->query("UPDATE device SET time='$time' WHERE id = '$id"); + $this->mysqli->query("UPDATE device SET time='$time' WHERE id = '$id'"); } } } From 4bd32c63ec2bbc60a444fc0830c2f343a9439988 Mon Sep 17 00:00:00 2001 From: chaveiro Date: Thu, 16 Sep 2021 14:05:37 +0100 Subject: [PATCH 6/6] Update device_dialog.js Convert tabs to spaces --- Views/device_dialog.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Views/device_dialog.js b/Views/device_dialog.js index 1c75609..f5b1620 100644 --- a/Views/device_dialog.js +++ b/Views/device_dialog.js @@ -105,7 +105,7 @@ var device_dialog = body.append( "
" + + "data-type='"+id+"' class='group-device'>" + ""+name+"" + "
" ); @@ -277,7 +277,7 @@ var device_dialog = } } update(); - $('#device-config-modal').modal('hide'); + $('#device-config-modal').modal('hide'); if (init) device_dialog.loadInit(); } else { @@ -429,44 +429,44 @@ var device_dialog = var label; switch(process['arguments']['type']) { case 0: // VALUE - label = "important"; + label = "important"; title = "Value - "; break; case 1: //INPUTID - label = "warning"; + label = "warning"; title = "Input - "; break; case 2: //FEEDID - label = "info"; + label = "info"; title = "Feed - "; break; case 3: // NONE - label = "important"; + label = "important"; title = ""; break; case 4: // TEXT - label = "important"; + label = "important"; title = "Text - "; break; case 5: // SCHEDULEID - label = "warning"; + label = "warning"; title = "Schedule - " break; default: - label = "important"; + label = "important"; title = "ERROR - "; break; } - title += process["name"]; + title += process["name"]; if (process['arguments']['value'] != undefined) { - title += ": " + process['arguments']['value']; + title += ": " + process['arguments']['value']; } out += ""+process["short"]+" ";