FHEM Forum

FHEM => English Corner => Thema gestartet von: mflammia1 am 10 September 2015, 00:43:22

Titel: Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: mflammia1 am 10 September 2015, 00:43:22
Hi,

I currently have a wall thermostat and a radiator TVR that each log and chart separately. Both the wall thermostat and TVR charts current temperature, set temperature and valve position.

Wall thermostat records current temperature and set temperature and the TVR records the valve position and set temperature.

It would therefore make more sense to have one chart that merges the wall thermostats current temperature and set temperature along with the valve position - is there a way to do this?

Here is an example of config that I am using:

###Bathroom Wall Thermostat
define MAX_Bathroom_Thermostat MAX WallMountedThermostat 0f78d8
define FileLog_MAX_Bathroom_Thermostat FileLog ./log/MAX_0f78d8-%Y.log MAX_Bathroom_Thermostat
attr MAX_Bathroom_Thermostat IODev cm
attr MAX_Bathroom_Thermostat room MAX
attr MAX_Bathroom_Thermostat group Bathroom
attr MAX_Bathroom_Thermostat alias Bathroom Thermostat
attr FileLog_MAX_Bathroom_Thermostat fm_type [{"title":"Temperature","id":"graph-temp","min":"auto:0","max":"auto:20","col":"a90000","h":2}]
attr FileLog_MAX_Bathroom_Thermostat logtype text
attr FileLog_MAX_Bathroom_Thermostat room MAX
attr FileLog_MAX_Bathroom_Thermostat group Bathroom

###Bathroom Wall Thermostat Chart
define MAX_Bathroom_weblink SVG FileLog_MAX_Bathroom_Thermostat:max_temp:CURRENT
attr MAX_Bathroom_weblink label "Bathroom Set-Temperature Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr MAX_Bathroom_weblink alias Bedroom Thermostat Chart
attr MAX_Bathroom_weblink room MAX
attr MAX_Bathroom_weblink group Bathroom

##Bathroom TVR
define MAX_Bathroom_TVR MAX HeatingThermostat 0ddeb3
define FileLog_MAX_Bathroom_TVR FileLog ./log/MAX_0ddeb3-%Y.log MAX_Bathroom_TVR
attr MAX_Bathroom_TVR IODev cm
attr MAX_Bathroom_TVR alias Bathroom TVR
attr MAX_Bathroom_TVR fm_type desiredtemp,tempbutton,actuators
attr MAX_Bathroom_TVR room MAX
attr MAX_Bathroom_TVR group Bathroom
attr FileLog_MAX_Bathroom_TVR fm_type [{"title":"Temperature","id":"graph-temp","min":"auto:0","max":"auto:20","col":"a90000","h":2}]
attr FileLog_MAX_Bathroom_TVR logtype text
attr FileLog_MAX_Bathroom_TVR room MAX
attr FileLog_MAX_Bathroom_TVR group Bathroom

### Bathroom TVR Chart ###
define MAX_Bathroom_TVR_weblink SVG FileLog_MAX_Bathroom_TVR:max_temp:CURRENT
attr MAX_Bathroom_TVR_weblink label "Bathroom_TVR Set-Temperature Min $data{min1}, Max $data{max1}, Last $data{currval1}"
attr MAX_Bathroom_TVR_weblink alias Bathroom TVR Chart
attr MAX_Bathroom_TVR_weblink room MAX
attr MAX_Bathroom_TVR_weblink group Bathroom


Thanks in advance
Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: fruit am 10 September 2015, 08:40:25
There is a way, but it may confuse you until you understand the way it works ;) See http://fhem.de/commandref.html#logProxy (http://fhem.de/commandref.html#logProxy)

I don't have wall stats but have a combined plot with a MAX stat and weatherstation - image is an old plot

define wl_Hall SVG myProxy:my_logP_HT:CURRENT
attr wl_Hall label "Hall: Min: $data{min7}, Max: $data{max7}, Last: $data{currval7} °C, Valve: $data{currval8} %"
attr wl_Hall plotfunction WeatherStation MAX_0759c6
attr wl_Hall plotsize 800,200
attr wl_Hall room Hall,Plots


The plot file I use (my_logP_HT.gplot) is

# Created by FHEM/98_SVG.pm, 2014-01-31 17:03:54
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<L1>'
set ytics
set y2tics
set grid y2tics
set ylabel "percent %"
set y2label "Temperature (deg C)"
set yrange [0:100]
set y2range [:25]
#set format y "%.1f"
#set format y2 "%.1f"
#================================================

#================================================
# if you need a ':' in regex or function replace it by '\x3a'
# syntax:  <col/spec>:<regexp>:<default>:<fn> (@fld,0-based,NO space)
#           <SPEC1>:attr:0:[int|delta-h,delta-d|$fld[3]=~"on"?0.9:0.1]
#================================================
#FileLog 4:<SPEC1>:temperature::
#FileLog 4:<SPEC1>:humidity::
#FileLog 4:<SPEC1>:dewpoint::
#FileLog 4:<SPEC1>:windSpeed::delta-h


#FileLog 4:<SPEC2>:desiredTemperature:4.5:
#FileLog 4:<SPEC2>:temperature:4.5:
#FileLog 4:<SPEC2>:valveposition:0:
#================================================
#logProxy FileLog:FileLog_<SPEC1>:4:<SPEC1>.temperature::
#logProxy FileLog:FileLog_<SPEC1>:4:<SPEC1>.humidity::
#logProxy FileLog:FileLog_<SPEC1>:4:<SPEC1>.dewpoint::
#logProxy FileLog:FileLog_<SPEC1>:4:<SPEC1>.windSpeed::delta-h

#logProxy ConstY:0

#logProxy FileLog:FileLog_<SPEC2>:4:<SPEC2>.desiredTemperature::
#logProxy FileLog:FileLog_<SPEC2>:4:<SPEC2>.temperature::
#logProxy FileLog:FileLog_<SPEC2>:4:<SPEC2>.valveposition::

#logProxy Func:logProxy_WeekProfile2Plot("<SPEC2>",$from,$to)

#================================================

#================================================
# colors
# l0 ... red        l0fill ... red           l0dot ... red, dotted
# l1 ... green      l1fill ... green         l1dot ... green, dotted
# l2 ... blue       l2fill ... blue          l0fill_stripe ... red, filled, stripes
# l3 ... magenta    l3fill ... magenta       l1fill_stripe ... green, filled, stripes
# l4 ... brown      l4fill ... yellow        l0fill_gyr ... filled, multicolor
# l5 ... black      l5fill ... cyan
# l6 ... olive      l6fill ... black
# l7 ... gray
# l8 ... yellow
#================================================
# line types
# points
# lines
# steps - draws from the last to the new value with the old value a line
# fsteps - draws from the last to the new value with the new value line
# histeps - records the transition from the old to the new value centered between the values
# bars
#================================================
plot "<IN>" axes x1y2 title 'Ext-temp' ls l0 lw 1 with lines, \
     "<IN>" axes x1y1 title 'humidity' ls l1 lw 1 with lines, \
     "<IN>" axes x1y2 title 'dewpoint' ls l2 lw 1 with lines, \
     "<IN>" axes x1y1 title 'windspeed' ls l6fill lw 1 with steps, \
     "<IN>" using 1:2 axes x1y2 notitle ls l4 lw 1 with steps,\
     "<IN>" axes x1y2 title 'desiredTemp' ls l3 lw 1 with steps, \
     "<IN>" axes x1y2 title 'Int-temp' ls l1fill lw 1 with lines, \
     "<IN>" axes x1y1 title 'valve %' ls l5 lw 1 with histeps, \
     "<IN>" using 1:2 axes x1y2 title 'weekprofile' ls l7 lw 1 with steps
#================================================


Edit:
You'll need to define your proxy too
define myProxy logProxy
attr myProxy room System
Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: rudolfkoenig am 11 September 2015, 11:22:21
You can merge two FileLogs with the "set FileLog1 absorb FileLog2" command. Read and understand the documentation before you execute the command.

With an up-to-date FHEM you can specify a different source for each line in the SVG chart (check your SVG in the SVG-Editor), the FileLog merge is not necessary.
Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: mflammia1 am 14 September 2015, 22:45:52
Much appreciate the comments, your time , and the detail provided.

I'm trying to work my through the configuration, which is a challenge but willing to learn.

This maybe obvious but I've tried Google'ing 'FHEM SVG-Editor' but struggling to find anything. Apologies that this maybe an obvious question but could you please give more detail, as I would like to explore this also, how do I use this to merge charts / logs.

Many thanks.
Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: fruit am 15 September 2015, 06:42:45
It can make your head hurt at times ;)
I hadn't realised until Rudolf's post that multi-device was possible without logProxy, I should read commandref more often!

Within the SVG section of commandref see plotfunction and <SPEC1> etc. See also http://www.fhemwiki.de/wiki/Creating_Plots_-_caching_SVG's (http://www.fhemwiki.de/wiki/Creating_Plots_-_caching_SVG's) for a simple example of its use - though it's about caching, there may be better examples but my German searching isn't up to much :(

In my code above you will see I use <SPEC1> and <SPEC2> in the gplot file and..
attr wl_Hall plotfunction WeatherStation MAX_0759c6
in the plot definition

in another room I have another definition containing..
attr wl_Bed_Room2 plotfunction WeatherStation MAX_075be0
<SPEC1> remains the same in both (WeatherStation) whereas  <SPEC2> refers to the MAX device in each room

I hope that makes it a little clearer
Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: rudolfkoenig am 15 September 2015, 07:09:19
Zitattried Google'ing 'FHEM SVG-Editor' but struggling to find anything

This (http://forum.fhem.de/index.php/topic,11275.msg75594.html#msg75594) is the original post, but it is outdated in the meantime.
Here (http://www.fhemwiki.de/wiki/Buderus_Web_Gateway#Mit_FileLog) is a description of the fields.

I thought it is self explanatory if you find it: go to the Detail-Page of an SVG by clicking on the link below the Plot.
You can create an SVG from the FileLog detail page (look for "Create SVG plot").

Titel: Antw:Merge Charts for Wall Thermostat and Radiator Valve?
Beitrag von: mflammia1 am 16 September 2015, 22:24:55
Brilliant - thank you both, found both parts of the information really helpful thank you.

First I configured using the command line, and got it working but had a lot of graphs to do so tried SVG-Editor. And you where right, it was very self explanatory once I found the link, which in itself was easy to find once I upgraded as you suggested!

Thanks again for being so helpful.