Page 1 of 1

Rule in espeasy für Hysterese

Posted: 15 Mar 2019, 22:13
by Mynameisfu
Ich habe ein rule auf meinen ESPeasy Relativ einfach. er zeigt mir temp 1 die Kollektor Temperatur und mit temp 2 die Puffer Temperatur und schaltet eine Pumpe ein wenn temp 1 größer als temp 2 ist. So weit so gut das funktioniert auch bombe aber ich möchte eine Hysterese einbauen also temp 1 plus 10grad damit die pumpe nicht so viel taktet.

Code: Select all

on 1#Temperature do
    if [1#Temperature] > [2#Temperature] 
        gpio,5,0
    endif
    if [1#Temperature] < [2#Temperature]
        gpio,5,1
    endif
endon
That's wonderful, but I do not get any hysteresis
I thought of something like that.

Code: Select all

on 1#Temperature do
    if [1#Temperature] + 10
    if [1#Temperature] > [2#Temperature]
        gpio,5,0
    endif
    if [1#Temperature] < [2#Temperature]
        gpio,5,1
    endif
endon

I hope you can help me with my problem love greetings Fu
ps. Sorry for my english :roll:

Re: Rule in espeasy für Hysterese

Posted: 16 Mar 2019, 00:59
by Shardan
Maybe something easy helps

It should be possible to calculate a hysteresis into the rules.

I can't say if calculations can be done within the "if"... if so, it should be possible to use something like

Code: Select all

on 1#Temperature do

    if [1#Temperature] > ( [2#Temperature] + 5 )
        gpio,5,0
    endif

    if ( [1#Temperature] -5 ) < [2#Temperature]
        gpio,5,1
    endif
endon
for a 10° hysteresis.

Please beware, i didn't test that.

If these calculations do not work, it should be possible to use a dummy variable to calculate it.

Re: Rule in espeasy für Hysterese

Posted: 16 Mar 2019, 19:52
by Mynameisfu
Hi
That's exactly how I imagined it, but unfortunately it does not work. It shows no reaction.
How did you mean that with the dummy?

PS
I have also tried another reins but also without success.

Re: Rule in espeasy für Hysterese

Posted: 16 Mar 2019, 20:25
by Shardan
A dummy is a task without any sensor or actor.

Let's say you use task No. 5 and define it as a dummy as you define an usual sensor or actor.
A dummy has 4 "outputs", var1...var4.
It can be set from rules with the command

Code: Select all

taslvalueset <tasknr>,<valuenr>,<value> 
So create a dummy in task 5, call it "TempHys" for example, call the values var1...var4.

You may set the values with

Code: Select all

taskvalueset 5,1,[1#Temperature}-5
taskvalueset 5,2,[2#Temperature}+5
You can check the results inside the task list.

These values can be used as any other sensor value, so change your rules to

Code: Select all

on 1#Temperature do
    taskvalueset 5,1,[1#Temperature}-5
    taskvalueset 5,2,[2#Temperature}+5
    if [1#Temperature] > [TempHys#var2]
        gpio,5,0
    endif

    if [TempHys#Var1] < [2#Temperature]
        gpio,5,1
    endif
endon
It might even be possible to use the formula field within the dummy variables,
they can be set to "%value% - 5" and "%value% + 5".

Just antother thing I didn't note with my last post:
Are you sure, the tasks are just called "1" and "2" as [1#Temperature] says?
This might be not a good idea. I'm not sure if these are really recognized as an event.
If I may suggest (Assuming that it is a heating flow measuring) to call them
Task name: Vorlauf, Value name: Temp
Taskname: Ruecklauf, Value name: Temp

You may check the log if an event is generated at all.
If temperature changes a line with "EVENT Vorlauf#Temp xx.xx" should occur.
(Or "1#Temperature xx.x" with your actual rule)
If no such event is generated, nothing will happen.

Re: Rule in espeasy für Hysterese

Posted: 16 Mar 2019, 23:13
by Mynameisfu
on 1#Temperature do
taskvalueset 7, 1, [1#Temperature]-5
taskvalueset 7, 2, [2#Temperature]+3
if [1#Temperature] > [TempHys#var2]
gpio,5,0
endif

if [TempHys#var1] < [2#Temperature]
gpio,5,1
endif
endon



So it worked, thank you very much and wish you a nice day.
LG Fu