This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Wiser for KNX, hours counter
#1
Hello 
I need help with Wiser for KNX.
How to activate hours counter for switch actuator, set limit, after the reaching limit, send email and alarm. Then I want visualize hours counter and how many hours is left? Can i do it with functions block editor?
Reply
#2
Hi
Something like that should do. Load this to FB and select your correct objects and generate.
If this works I can make you email block for FB as there is none at the moment.
BR

Attached Files
.json   fbeditor.json (Size: 7 KB / Downloads: 39)
------------------------------
Ctrl+F5
Reply
#3
(11.06.2018, 11:25)Daniel. Wrote: Hi
Something like that should do. Load this to FB and select your correct objects and generate.
If this works I can make you email block for FB as there is none at the moment.
BR
Thanks, I'll try
Reply
#4
Hi
Here is the email block
To add it first go to Scripting -> User libraries and import this library.  You have to edit it and set your email account parameters



Code:
-- "from" field, only e-mail must be specified here
   from = 'example@gmail.com',
   -- smtp username
   user = 'example@gmail.com',
   -- smtp password
   password = 'mypassword',
   -- smtp server
   server = 'smtp.gmail.com',
   -- smtp server port
   port = 465,
   -- enable ssl, required for gmail smtp
   secure = 'sslv23',

It should looks like the json attached in FB
BR

Attached Files
.gz   Libraries-LogicMachine-2018.06.12-09.06.tar.gz (Size: 1.32 KB / Downloads: 31)
.json   fbeditor.json (Size: 10.37 KB / Downloads: 27)
------------------------------
Ctrl+F5
Reply
#5
Where you find function “send email” in FB editor?


Skickat från min iPhone med Tapatalk
Reply
#6
(12.06.2018, 12:12)Ruslan25 Wrote: Where you find function “send email” in FB editor?


Skickat från min iPhone med Tapatalk

Once you import the library it will be under User.FB_Email

Attached Files Thumbnail(s)
   
------------------------------
Ctrl+F5
Reply
#7
Thanks a lot. One more question.
Under setpoint you wrote 20 and its in seconds, how can I convert to hours. Because I want visualize how many hours is left


Skickat från min iPhone med Tapatalk
Reply
#8
(12.06.2018, 14:11)Ruslan25 Wrote: Thanks a lot. One more question.
Under setpoint you wrote 20 and its in seconds, how can I convert to hours. Because I want visualize how many hours is left


Skickat från min iPhone med Tapatalk

To be honest with you I never ever used this block Smile.  I looked on the code behind and it is already in hours. 

Code:
   local hours = (os.time() - start) / 3600
   return hours, setpoint - hours, hours > setpoint and true or nil
The 20 should be 20 hours
------------------------------
Ctrl+F5
Reply
#9
And? This is just how the end scripts looks like, The one I checked is the function used by this script. This is where all the calculation is actually hiding.
------------------------------
Ctrl+F5
Reply
#10
Do you mean under common functions?


Skickat från min iPhone med Tapatalk
Reply
#11
(12.06.2018, 15:00)Ruslan25 Wrote: Do you mean under common functions?


Skickat från min iPhone med Tapatalk

No  apps have their own library and you don't see them anywhere by default.  If you really want to look you can import them in  user libraries from here.
https://forum.logicmachine.net/showthrea...49#pid4849
You are looking for the last one.
------------------------------
Ctrl+F5
Reply
#12
Sorry, I mean that remaining time is in seconds

(12.06.2018, 15:11)Daniel. Wrote:
(12.06.2018, 15:00)Ruslan25 Wrote: Do you mean under common functions?


Skickat från min iPhone med Tapatalk

No  apps have their own library and you don't see them anywhere by default.  If you really want to look you can import them in  user libraries from here.
https://forum.logicmachine.net/showthrea...49#pid4849
You are looking for the last one.

Which data type should I use for hours counter?
Reply
#13
No it is in hours. Setpoint - hours = Remaining. This is the second parameter in the function I posted.
------------------------------
Ctrl+F5
Reply
#14
(12.06.2018, 15:51)Daniel. Wrote: No it is in hours.  Setpoint - hours = Remaining. This is the second parameter in the function I posted.

Interesting that hours counter in hours, but remainig time is in seconds, under Objects - current value
Reply
#15
Ok you interest me to check it myself. It looks like the block posted in the forum do not match what it is actually in the FB Editor.
Import the library from forum and replace existing block by the one from user library. It will be in hours then. I will check with the source why it was changed. Or you can use divide block to divide it by 3600 then it will be in hours too.
------------------------------
Ctrl+F5
Reply
#16
I ran your script Daniel and works good.

But i want to just trigger and send an alarm, lets say when an temperatur goes higher than 20.
I was thinking of linking the temp to an "greater than" and use a value for the input 2. I guess this will trigger the alarm.
But i would like to send the value as well as the message text?

Is there some solution for this..
Reply
#17
Try using the combine text block from strings. Not sure if it will accept numbers or if you also have to convert it with int to str
------------------------------
Ctrl+F5
Reply
#18
(15.06.2018, 13:02)Daniel. Wrote: Try using the combine text block from strings. Not sure if it will accept numbers or if you also have to convert it with int to str

I did some testing. And ended up with an Greater then block, combine text and Send email.

Which seems to work great with the result i want.

BUT i made an output 9/3/1 group in Logic Machine to send the output. But this keeps changing without the "Greater than" block has any change. Watchable in the linked video. I really dont understand why it keeps changing. .

Any idea would be highly appreciated  Smile

I could not attach an wmv so i put it to an ddropbox folder..

https://www.dropbox.com/sh/c131ixflgi1th...TdIXa?dl=0
Reply
#19
Hi
Save your diagram in json and drop here please. The timer value maximum value is 60, not sure why you were able to make so bug one.
BR
------------------------------
Ctrl+F5
Reply
#20
(18.06.2018, 07:28)Daniel. Wrote: Hi
Save your diagram in json and drop here please.  The timer value maximum value is 60, not sure why you were able to make so bug one.
BR

Here is the json file. Thanks for the help..

Attached Files
.json   fbeditor (5).json (Size: 10.5 KB / Downloads: 11)
Reply


Forum Jump: