Page 1 of 1
Analog and Digital custom graph
Posted: Saturday 12 November 2016 11:54
by danjardmathieu
Hi
Would it be possible to implement the DIGITAL devices to the custom graph to be able to capture on the same charts a temperature, his setpoint and the command device ?
Many thanks
Re: Analog and Digital custom graph
Posted: Saturday 12 November 2016 12:23
by stlaha2007
Temperature and setpoint are available as a Evohome Zone devices. Added it through json-api and feesing it with my livingroom temp-sensor and thermostat setpoint through a script. It shows under the temperature and then you can select other temp-sensors including the temp-setpoint into one custom graph.
Dont understand what you mean by commanddevice. Is it what i already describe above or something else?
Re: Analog and Digital custom graph
Posted: Saturday 12 November 2016 12:58
by danjardmathieu
Re
I mean by command device, the device which will heat or cool, depending the way of the regulation.
For me it's a simple relay to power a heater.
Re: Analog and Digital custom graph
Posted: Monday 14 November 2016 7:45
by stlaha2007
So basicly a On/Off switch, right?
How about using the setpoint as described as fixed say 100 degrees is on/0 degrees is of?
Re: Analog and Digital custom graph
Posted: Monday 14 November 2016 13:34
by danjardmathieu
Hi
Yes it's a good idea but ...
My configuration is the following :
Temperature is comming from a oregon temperature sensor.
The heater is piloted by a 433Mhz ON/OFF switch.
The setpoint is a dummy thermostat.
How can i do?
Maybe by creating a dummy temperature sensor and do what you proposed previously via a lua script (off is 0°c and on is 30°c)
Re: Analog and Digital custom graph
Posted: Monday 14 November 2016 23:55
by stlaha2007
I'll get back later this week with a script (bash-shell) which i wrote myself/use and does the combination of temp and setpoint (dummy thermostat). I'll add a if..then for the switching... As i have less expirience with Blockly and Lua which are also capable of switching based on your example.
Sent from my K00C using Tapatalk
Re: Analog and Digital custom graph
Posted: Tuesday 15 November 2016 7:03
by danjardmathieu
Great news.
Looking forward for your script.
Cheers
Re: RE: Re: Analog and Digital custom graph
Posted: Tuesday 15 November 2016 18:38
by stlaha2007
danjardmathieu wrote:Great news.
Looking forward for your script.
Cheers
To get you started... a few days ago i posted the script anf instruction to combine temp and setpoint here
http://www.domoticz.com/forum/viewtopic ... 80#p103580
Re: Analog and Digital custom graph
Posted: Saturday 19 November 2016 17:55
by stlaha2007
As previously mentioned.... I posted a script already....
Here is a copy of it with the if statement to check for current temp in livingroom when below setpoint it turns the heater switch on. if equal or higher then setpoint it wil turn heater of.
I also do some mathmetics with the help of bc on my Raspbian so install that with sudo apt-get install bc
Code: Select all
scriptname: update_heat_zone_switch.sh
#!/bin/bash
#### Description of update_heat_zone_switch.sh
#### Purpose: To read and write Current Living Temp and Thermostat Setpoint from/into Domoticz
#### And turn On/Off the switch for the heater
#### Created: 2016-11-05
#### Modified: 2016-11-16
#### Owner: STLAHA2007
#### Functionalities: Read current temp and setpoint from Domoticz {curl/json/grep/awk/sed}
#### Write into combined Zone sensor to Domoticz {curl/json/grep/awk/sed}
#### This script needs {Unix-style} execute rights (755 - rwx r-x r-x)
#### Declare temporary variables for read/calculate/write
declare CurrentLiving_Temp
declare CurrentLiving_SetPoint
declare -i CurrentLiving_Temp_IDX
declare -i CurrentLiving_SetPoint_IDX
declare HeatZoneLiving_Value
declare -i HeatZoneLiving_IDX
declare -i HeateterSwitch_IDX
declare DomoURL
DomoURL=$(echo "http://domoticz.ip.address:port")
CurrentLiving_Temp_IDX=123
CurrentLiving_SetPoint_IDX=456
HeatZoneLiving_IDX=789
HeaterSwitch_IDX=1024
#### read and calculate current temp and setpoint
CurrentLiving_Temp=$(echo $(curl -s "$(echo $DomoURL)/json.htm?type=devices&rid=$(echo $CurrentLiving_Temp_IDX)" | grep "Data\"" | awk '{print $3}' | sed 's/\"//g' | sed 's/\,//g'| sed 's/\.000//g' ))
CurrentLiving_SetPoint=$(echo $(curl -s "$(echo $DomoURL)/json.htm?type=devices&rid=$(echo $CurrentLiving_SetPoint_IDX)" | grep "Data\"" | awk '{print $3}' | sed 's/\"//g' | sed 's/\,//g'| sed 's/\.000//g' ))
HeatZoneLiving_Value=$(echo $(curl -s "$(echo $DomoURL)/json.htm?type=devices&rid=$(echo $HeatZoneLiving_IDX)" | grep "Data\"" ))
echo $CurrentLiving_Temp
echo $CurrentLiving_SetPoint
echo $HeatZoneLiving_Value
echo "HeatzoneLiving_Value needs to look like....:"
HeatZoneLiving_Value=$(echo $CurrentLiving_Temp";"$CurrentLiving_SetPoint";0;")
echo $HeatZoneLiving_Value
##echo "Electra: "$(echo $M_E_Curr)" kWh Gas: "$(echo $M_G_Curr)" m3 Water: "$(echo $M_W_Curr)" m3"
curl -s "$(echo $DomoURL)/json.htm?type=command¶m=udevice&idx=$(echo $HeatZoneLiving_IDX)&nvalue=0&svalue=$(echo $HeatZoneLiving_Value)"
### Toggle Switch On/Off ############
##
## JSON-API to Toggle (Switch over from current state On becomes Off/Off becomes On:
## /json.htm?type=command¶m=switchlight&idx=99&switchcmd=Toggle
##
## JSON-API to Switch On/Off:
## /json.htm?type=command¶m=switchlight&idx=99&switchcmd=On / switchcmd=Off
##
#####################################
##if (( $(echo "$Meter_Diff > 0"| bc ) && $(echo "$Meter_Diff < 5001" | bc ) ))
if (( $(echo "$CurrentLiving_Temp < $CurrentLiving_SetPoint" | bc ) ))
then
echo "Turning on heater !!"
curl -s "$(echo $DomoURL)/json.htm?type=command¶m=switchlight&idx=$(echo $HeaterSwitch_IDX)&switchcmd=On"
fi
if (( $(echo "$CurrentLiving_Temp >= $CurrentLiving_SetPoint" | bc) ))
then
echo "Turning off heater !!"
curl -s "$(echo $DomoURL)/json.htm?type=command¶m=switchlight&idx=$(echo $HeaterSwitch_IDX)&switchcmd=Off"
fi
pi@domoticz:~$
Sent from my K00C using Tapatalk