Skip to content

Commit

Permalink
Merge pull request #1069 from lokonli/domoticzApi
Browse files Browse the repository at this point in the history
Domoticz API fix changes
  • Loading branch information
lokonli authored Jun 6, 2023
2 parents 2d8095b + 89d377c commit 6656035
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
8 changes: 8 additions & 0 deletions docs/releasenotes/releasenotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ For Dashticz's **master** version Release Notes go to: https://dashticz.readthed
Recent changes
---------------

v3.10.5 Beta (6-6-2023)
-------------------------

Fixes
~~~~~

* Fix for additional changes in Domoticz API (2023.1, build 15327 and up)

v3.10.4 Beta (4-6-2023)
-------------------------

Expand Down
14 changes: 8 additions & 6 deletions js/components/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function getDeviceDefaults(me, device) {
case 'Wind':
sensor = 'wind';
var windspeed = device.Data.split(';')[2] / 10;
if (config['use_beaufort']) {
if (settings['use_beaufort']) {
currentValue = Beaufort(windspeed);
decimals = 0;
txtUnit = 'Bft';
Expand Down Expand Up @@ -491,7 +491,7 @@ function getAllGraphData(me) {

function getRegularGraphData(me, i) {
var device = me.graphDevices[i];
var cmd = domoVersion.newGraphApi ? 'type=command&param=graph' : 'type=graph';
var cmd = domoVersion.api15330 ? 'type=command&param=graph' : 'type=graph';
var params = cmd +
'&sensor=' +
device.sensor +
Expand All @@ -509,7 +509,7 @@ function getSwitchGraphData(me, i) {
var device = me.graphDevices[i];
//http://:8080/json.htm?idx=19&type=lightlog
//todo: check type=command&param=graph for new Domoticz version>=15330
var cmd = domoVersion.newGraphApi ? 'param=getlightlog&type=command' : 'type=lightlog';
var cmd = domoVersion.api15330 ? 'param=getlightlog&type=command' : 'type=lightlog';
var params = cmd + '&idx=' + device.idx;
me.params[i] = params;
return Domoticz.request(params).then(function (data) {
Expand Down Expand Up @@ -1501,7 +1501,7 @@ function showData(graph) {
html += ' <div class="modal-dialog" role="document">';
html +=
' <div class="modal-content" style="background-image:url(' +
config['background_image'] +
settings['background_image'] +
'); background-size: cover;">';
html += ' <div class="modal-header">';
html += ' <div class="flex-row title">';
Expand All @@ -1515,7 +1515,7 @@ function showData(graph) {
' <a type="button" id="logbutton" class="btn debug" href="#" ><i class="fas fa-code"></i></a>';
html +=
' <a type="button" class="btn debug" href="data:application/octet-stream;charset=utf-16le;base64,' +
btoa(JSON.stringify(graph, null, 2)) +
btoa(encodeURIComponent(JSON.stringify(graph, null, 2))) +
'" download="' +
graphIdx +
'.json"><i class="fas fa-save"></i></a>';
Expand Down Expand Up @@ -1571,7 +1571,9 @@ function showData(graph) {
$.each(graph.graphDevices, function (i, graphDevice) {
// var g = dtGraphs[graph.primaryIdx]; //todo: I would expect g is just graph
var url =
config['domoticz_ip'] + '/json.htm?type=devices&rid=' + graphDevice.idx;
config['domoticz_ip'] + '/json.htm?' +
(domoVersion.api15330?'type=command&param=getdevices':'type=devices') +
'&rid=' + graphDevice.idx;

$.getJSON(url, function (data) {
var device = data.result[0]; //This device should already contain the same info as graphDevice.
Expand Down
16 changes: 9 additions & 7 deletions js/domoticz-api.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions version.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"version": "3.10.4",
"version": "3.10.5",
"branch": "beta",
"last_changes": "Fix graphs for Domoticz version>=15330",
"last_changes": "Fix for additional Domoticz API changes version>=15327",
"changelog" : {
"3.10.4": "Fix graphs for Domoticz version>=15330",
"3.10.3": "OpenWeaterMap 3.0 API and generic garbage company afvalinfo",
"3.10.2": "P1 and energy dials: subtype 'power' to show actual power usage.",
"3.10.1": "Support for authentication Domoticz>14708",
Expand Down

0 comments on commit 6656035

Please sign in to comment.