Page 2 of 15

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 10:35
by ykuijs
I was using 3.2.1 beta. Just tested 3.3.1 beta and there all works well.

The missing color variables were indeed the issue. Changed this to HTML values and now no error is displayed. However the graphs in the right column are still missing and the multigraph (which is using the same devices) are all missing.

Tested to move the graphs from the right to the middle column, but no luck there.
Tested to use other devices (temperature devices) for the multigraph, no luck here as well.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 10:49
by ykuijs
Just noticed that for the three missing graphs, I did not have any blocks declared (so it would render using default settings). I declared a block for one graph and after a refresh, that graph is now displayed.

So it looks like the graph is no longer rendered using default settings in 3.3.1 beta.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 10:53
by clinkadink
Thanks @ykuijs. Glad the colors part is solved.

Yes, the graph blocks was my fault. Basically, with my code it meant that all "graph" blocks need to be declared first (which isn't ideal). This has already been fixed this already in the multigraph branch last night. Apologies.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 11:19
by ykuijs
Yes, that was it. Got the new bits from the multigraph branch, removed the declarations and the graphs display just fine.

This just leaves the multigraph not showing. How can I troubleshoot?

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 11:22
by clinkadink
Any chance you can post your graph/multigraph blocks and column assignments of your config.js? You can PM me if you prefer. This may help with debugging. Thanks.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 20:35
by renerene
Thank you!

Just started testng and tried to copy the CPU example.
Problem: dataset 2 = dataset 1 --> 2 lines shown as 1 line

Image
Image

Code: Select all

blocks['multigraph_460'] = {
	title: 'CPU, Memory & HDD',
	//devices: [ 456, 456, 458 ],
 	devices: [ 460, 456 ],
  //datasetColors: [colourRed, colourOrange, colourBlue, colourGreen, colourBlueLight, colourAqua, colourYellow, colourPurple, colourPink],
  //datasetColors: ['red', 'yellow', 'blue', 'orange', 'green', 'purple', 'orange', 'lightblue', 'lightred'],
  datasetColors: ['red', 'yellow'],
	cartesian : 'linear', 	
	graph: 'line',
	fill: true,
  width: 5,
}

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 21:27
by clinkadink
"fill" was changed to "lineFill". Maybe that's the reason.

The full list of properties are in this post:
https://www.domoticz.com/forum/viewtopi ... 45#p233460

Also, see if there are any errors in the developer console. You can view it by pressing F12 on the keyboard.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 22:25
by renerene
Got my first multi temp working. Found out that the IDX device numbers have to be in ascending order

OKAY:

Code: Select all

blocks['multigraph_1348'] = {
devices: [ 1348, 1352 ],
}
NOT OKAY:

Code: Select all

blocks['multigraph_1348'] = {
devices: [ 1352, 1348 ],
}
NOT OKAY:

Code: Select all

blocks['multigraph_1352] = {
devices: [ 1352, 1348 ],
}

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 22:35
by renerene
also:

1) gas (P1 smart meter) and temperature does not work, no show, no error under F12
2) problem with dummy inside/outside average temperature sensor on Firefox and Chromium:
logarithmic = ok:
Image
linear = not ok / only 1 sensor visible:
Image
update: on my android tablet both lines are visible on linear, sort of:Image
oh, and now I also see it om my laptop?! Long uptime / load time apparantly
Update2: No, after switching back and forth from today to last hours the scale is correct
3) in that same graphic with logartithmic scale: in 'laatste uren' en 'vandaag' there are 2 lines. In 'afgelopen maand' there are 6 (?) lines: ta1, te1, tm1, ta2, te2, tm2

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 23:19
by clinkadink
@renerene, thanks for letting me know.

1. The P1 has lots of datasets on its own. I don't have one, so I really need some sample output to test. You can access it on your network like this:

Code: Select all

http://127.0.0.1:8080/json.htm?
      type=graph
      &sensor={counter|Percentage|temp|rain|fan|wind|uv}
      &idx={_ID_}
      &method={int}
      &range={day|week|month|year}
Example:
http://127.0.0.1:8080/json.htm?type=gra ... &range=day

2. Not sure why this is happening. Sounds like its device dependant.

3. When you set "month", you also get a minimum, maximum and average for each dataset.

Cheers.

Re: Multiple sources in one graph

Posted: Wednesday 15 January 2020 23:21
by clinkadink
renerene wrote: Wednesday 15 January 2020 22:25 Got my first multi temp working. Found out that the IDX device numbers have to be in ascending order
Yes, I have fixed this issue this evening ... I think ;) Need to commit it back to the multigraph branch once I have fixed some other bugs.

Re: Multiple sources in one graph

Posted: Thursday 16 January 2020 16:56
by renerene
clinkadink wrote: Wednesday 15 January 2020 23:19 1. The P1 has lots of datasets on its own. I don't have one, so I really need some sample output to test. You can access it on your network like this
Ok, here is the output of the gas metr
I've noticed that it is a spiky output, just one sum value per hour
http://192.168.0.xxx:8080/json.htm?type ... &range=day

Code: Select all

{
   "ValueQuantity" : "",
   "ValueUnits" : "",
   "result" : [
      {
         "d" : "2020-01-12 16:55",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:00",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:05",
         "v" : "0.26"
      },
      {
         "d" : "2020-01-12 17:10",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:15",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:20",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:25",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:30",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:35",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:40",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:45",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:50",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 17:55",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 18:00",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 18:05",
         "v" : "7.03"
      },
      {
         "d" : "2020-01-12 18:10",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 18:15",
         "v" : "0.00"
      },
      {
         "d" : "2020-01-12 18:20",
         "v" : "0.00"
      },
  
  
  etc.
  
      {
         "d" : "2020-01-16 16:50",
         "v" : "0.00"
      }
   ],
   "status" : "OK",
   "title" : "Graph counter day"
}
http://192.168.0.xxx:8080/json.htm?type ... range=week

Code: Select all

{
   "ValueQuantity" : "",
   "ValueUnits" : "",
   "result" : [
      {
         "d" : "2020-01-09",
         "v" : "7.814"
      },
      {
         "d" : "2020-01-10",
         "v" : "9.236"
      },
      {
         "d" : "2020-01-11",
         "v" : "11.322"
      },
      {
         "d" : "2020-01-12",
         "v" : "10.529"
      },
      {
         "d" : "2020-01-13",
         "v" : "8.506"
      },
      {
         "d" : "2020-01-14",
         "v" : "9.981"
      },
      {
         "d" : "2020-01-15",
         "v" : "8.857"
      },
      {
         "d" : "2020-01-16",
         "v" : "4.271"
      }
   ],
   "status" : "OK",
   "title" : "Graph counter week"
}
2.
2. Not sure why this is happening. Sounds like its device dependant.
See update above in original post: the graph is correct after swtching from day to week, back to day
3. it would be great to have a simple on/off switch also in the graph. I've tried it, but it doesn't work. Perfect way to fine tune my heating system and see how the temperature reacts to turning on the heating device.

Re: Multiple sources in one graph

Posted: Thursday 16 January 2020 18:59
by clinkadink
renerene wrote: Thursday 16 January 2020 16:56 Ok, here is the output of the gas metr
http://192.168.0.xxx:8080/json.htm?type ... &range=day

Code: Select all

{
   "ValueQuantity" : "",
   "ValueUnits" : "",
   "result" : [
      {
         "d" : "2020-01-12 16:55",
         "v" : "0.00"
      },
      // --- truncated --- //
      {
         "d" : "2020-01-16 16:50",
         "v" : "0.00"
      }
   ],
   "status" : "OK",
   "title" : "Graph counter day"
}
1. Thanks but I was after your P1 energy meter ;) Also, why does your gas meter with the url set to range=day output 4 days worth of data? That doesn't seem correct.

2. I discovered the same issue with just one of my many multigraphs. I updated the code last night (locally), it seems to be working fine now.

3. I don't quite understand what you mean in your third point.
renerene wrote: Thursday 16 January 2020 16:56it would be great to have a simple on/off switch also in the graph. I've tried it, but it doesn't work. Perfect way to fine tune my heating system and see how the temperature reacts to turning on the heating device.
Do you mean you want a button in the graph header to control the device's state? E.g. switch on, switch off? What have you tried that doesn't work? Immediate thoughts are that you would need multiple buttons for multiple devices. Not all devices are switchable, e.g. counters, percentages are not interactive so buttons would be pointless (in this case). Can you explain if this is what you mean?

Re: Multiple sources in one graph

Posted: Thursday 16 January 2020 19:52
by renerene
I don't quite understand what you mean in your third point.
I want the state of simple on/off devices to be seen in the graph. Did a short test yesterdam, i did not work. I guess the graphs only works for domoticz under tab temperature, wheather, utility. I also want them to work for tab 'switches'

Re: Multiple sources in one graph

Posted: Thursday 16 January 2020 23:12
by clinkadink
renerene wrote: Thursday 16 January 2020 19:52 I guess the graphs only works for domoticz under tab temperature, wheather, utility.
Yes, pretty much. The current graph/multigraph calls Domoticz using the 'graph' url, e.g.:

Code: Select all

http://127.0.0.1:8080/json.htm?type=graph&sensor=counter&idx=1&method=1&range=day
This url is specifically for sensors, the choices are counter, percentage, temp, rain, fan, wind and uv. The output data is already formatted for a graph.

That's not to say it can't be done. There is a url for binary devices such as switches, lights, motion sensors and contact sensors.

Code: Select all

http://127.0.0.1:8080/json.htm?idx=xxx&type=lightlog
Example of data is below. It is not formatted for a graph, which is probably why Domoticz do not display graphs for these types of devices. The data would need transforming first, before passing to a graph. Another consideration is how it would look. It would only ever have a value of 0 or 1. Depending on how often the device is used, it could be either a very boring, or chaotic looking graph ;)

Code: Select all

"result" : [
      {
         "Data" : "On",
         "Date" : "2020-01-16 21:10:11",
         "Level" : 255,
         "MaxDimLevel" : 100,
         "Status" : "On",
         "idx" : "1234066"
      },
      {
         "Data" : "Off",
         "Date" : "2020-01-16 20:16:25",
         "Level" : 0,
         "Status" : "Off",
         "idx" : "1233986"
      },
      // ---- truncated --- //
      {
         "Data" : "On",
         "Date" : "2020-01-16 19:55:48",
         "Level" : 255,
         "Status" : "On",
         "idx" : "1233919"
      }
]

Re: Multiple sources in one graph

Posted: Friday 17 January 2020 3:02
by renerene
No not boring, but interesting. Don't forget we are nerds ;-)
Thank you for explanation. I will make a shadow dummy switch for the heating device switch, to make it visible in the graph.

Re: Multiple sources in one graph

Posted: Friday 17 January 2020 10:58
by clinkadink
Just exported a 1 day's worth of data from my contact sensor, which is a binary device (open/closed). I knocked up a graph in Excel just to see how the data looks.

Image

When I tried the same with all data for the last 3 weeks, things get really busy ...

Image

I guess this is the type of detail you are looking for?

Re: Multiple sources in one graph

Posted: Friday 17 January 2020 11:19
by jake
Indeed, the multi graphs will save the time to export boiler temperature, room temperature and switch data to Excel for analysis

Re: Multiple sources in one graph

Posted: Friday 17 January 2020 11:41
by clinkadink
jake wrote: Friday 17 January 2020 11:19 Indeed, the multi graphs will save the time to export boiler temperature, room temperature and switch data to Excel for analysis
Yes, the multigraphs will do this for all "sensor" devices (e.g. counter|Percentage|temp|rain|fan|wind|uv).

The question @renerene is asking, is whether this can be extended to include "binary" devices (e.g. switch, socket, motion sensor, contact sensor, etc.). As these output completely different data, and only measure a binary state; e.g. off/off, open/closed, state.

Re: Multiple sources in one graph

Posted: Friday 17 January 2020 16:12
by clinkadink
The multigraph branch has been updated following all the feedback (thanks!).

https://github.com/Dashticz/dashticz/tree/multigraph

It includes several fixes including ... you now no longer have to sort the device IDs in the block's multigraphs.devices array.

There still seems to be an issue where device won't show as a graph "and" a multigraph. E.g. graph_1 and multigraph_1. I noticed it only matters if its the primary device id, and not any others in the multigraph.devices array.

Example:

This will not work (currently) - as their block ID ends in the same number.

Code: Select all

blocks['graph_17'] = {
        legend: true
}

blocks['multigraph_17'] = {
	devices: [ 189, 17, 18 ],
        legend: true
}
This will work - and displays the same data, just by switching the multigraph's block ID to another device. Its a workaround for now, whilst I fix it.

Code: Select all

blocks['graph_17'] = {
        legend: true
}

blocks['multigraph_189'] = {
	devices: [ 189, 17, 18 ],
        legend: true
}
Obviously, I can only test with my devices. You may get different results. This is very much 'work in progress', so please keep all the feedback coming :)