Set AnalogValue to same value

6 years 10 months ago #1793 by medyk8ns
Hello,
First of all I would like to thank you for great project and all the effort put in it.

I have created garden watering system. It works by setting virtual node analog value to required time value. Using automation this value is sent to ESP, which turns on sprinklers for given time.
The problem is that I can't set same value twice. For example if yesterday I've set time to 5 minutes, and today I would like to set it to 5 minutes again. This is not possible because value is the same as before. Is there any possibility to workaround it? Like property Settings.AllowSetSameValue?

Please Log in or Create an account to join the conversation.

6 years 10 months ago #1795 by EasyIoT

medyk8ns wrote: Hello,
First of all I would like to thank you for great project and all the effort put in it.

I have created garden watering system. It works by setting virtual node analog value to required time value. Using automation this value is sent to ESP, which turns on sprinklers for given time.
The problem is that I can't set same value twice. For example if yesterday I've set time to 5 minutes, and today I would like to set it to 5 minutes again. This is not possible because value is the same as before. Is there any possibility to workaround it? Like property Settings.AllowSetSameValue?


Thx. I've started EasyIoT project with balcony irrigation system :)

Why you can't send the same value twice? There is no limitation in EasyIoT server.

Please Log in or Create an account to join the conversation.

6 years 10 months ago - 6 years 10 months ago #1799 by medyk8ns
I think this is due to how AnalogOutput control works. If I have AnalogValue set to 9, then it is not possible to set it again to 9. In my case when I am setting watering time it would be nice if I could set it twice to the same value.
So lets say today I would like to turn on watering for 9 minutes, and tomorrow I would like to set it again to 9 minutes. It is not possible via WebInterface.
Attachments:

Please Log in or Create an account to join the conversation.

6 years 10 months ago #1801 by medyk8ns
After further testing it appered that jQuery Knob is not triggering release event. I will investigate it further and post soultion later.

Please Log in or Create an account to join the conversation.

6 years 10 months ago #1805 by EasyIoT

medyk8ns wrote: After further testing it appered that jQuery Knob is not triggering release event. I will investigate it further and post soultion later.


If you only open knob value is not sent. Value is sent if knob value is changed. Maybe better solution is to send value with cron job once per day, but value is set with virtual node and not send directly.

Please Log in or Create an account to join the conversation.

6 years 10 months ago - 6 years 10 months ago #1813 by medyk8ns
I open knob and move it around and stop at initial value.
After looking at source code of jquery.knob.js on GitHub I found line 523
&& v != this.v

After commenting out this line knob works as I would like it to.
In turn commenting this line breaks cancel method. Because I don't want to change knob.js code itselft, I ended with options of knob() like:
 'cancel' : function () {
                    this.val(this.v, false);
                },
 'draw' : function(){
                    if(this.val != myValMethod)
                    {
                        this.val = myValMethod;
                    }
                }

and it works for this particular case. It would be better to not to use draw function but I haven't found any better solution for overriding this.val() in knob.js.

Then in Ha.WebApp.Control.js I'va added:
var allowSameValue = Ha.WebApp.Utility.GetModulePropertyByName(module1, "Settings.AllowSameValue");
if(allowSameValue != undefined && allowSameValue.Value == 1)
{
//new knob code
}
else
{
//old knob code
}
So I can change this behavior only when I want to.

Usually those analog value will be set be cron job, but sometimes I would like to set it manually.

Please Log in or Create an account to join the conversation.

Time to create page: 0.214 seconds

Forum latest

  • No posts to display.