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.

Resident script pump circulation
#61
(29.10.2018, 16:56)buuuudzik Wrote: Could you define what means "not working"? What is current state of your system?

But probably I've found the source of problemWink Please log in "Object logs" valve status because for 99% you are updating your valve every minute(not only on change) so the timestamp is updated and is still too fresh and is recognized as not fully open.

Looks in logs:
[valvesInSummer]
     * table:
      [1]
       * table:
        [value]
         * bool: true
        [firstTimestamp]
         * number: 1540829552
        [name]
         * string: T7 FB Heating floor attic valve
        [opened]
         * bool: true

[valvesInSummer]
     * table:
      [1]
       * table:
        [value]
         * bool: true
        [firstTimestamp]
         * number: 1540829612
        [name]
         * string: T7 FB Heating floor attic valve
        [opened]
         * bool: true

[valvesInSummer]
     * table:
      [1]
       * table:
        [value]
         * bool: true
        [firstTimestamp]
         * number: 1540829672
        [name]
         * string: T7 FB Heating floor attic valve
        [opened]
         * bool: true

Everytime script runs there is different firstTimestamp which is equal to updatetime of valve with alias 'T7 FB Heating floor attic valve'. So the status of this valve is updated every minute. But this is not by this script because this script only controls the pump based on valve statuses.


I think you are upodating state of valve every minute. Please log

GREAT buuuudzik!!

I knew that everyminute status of valve sending on bus his value but honestly I did not think that occur this problem. Now it is working.

But if I set time valve status to 4 minutes you think problem will be again?

Thanks a lot again.
Reply
#62
No, it should be send only on change.

For monitoring of the device you can use heartbeat object or something similar. If you don't want change this repetition then you must create new object(could be virtual) and valve status must update its value by grp.checkupdate() method, but there is no reason and if you are working in automation then you must learn how to right use devices and then trust themWink Especially if it is about LMSmile
Done is better than perfect
Reply
#63
(29.10.2018, 20:33)buuuudzik Wrote: No, it should be send only on change.

For monitoring of the device you can use heartbeat object or something similar. If you don't want change this repetition then you must create new object(could be virtual) and valve status must update its  value by grp.checkupdate() method, but there is no reason and if you are working in automation then you must learn how to right use devices and then trust themWink Especially if it is about LMSmile

Thank you mate!
Reply
#64
You're welcomeWink
Done is better than perfect
Reply
#65
(29.10.2018, 21:44)buuuudzik Wrote: You're welcomeWink

Hi buuuudzik,
Please, why LM with javascript should be more efficient than with lua ? It is possible to use custom javascipt in visualization for some tasks, are talking about visualization or not ?

B.R,
Chouaibou.
Reply
#66
Hi,

JS processes are using the client CPU and not the LM CPU.

That’s why

BR,

Erwin
Reply
#67
You've probably confused threads, but okWink

I very like JS. This is very modern, fast(fast among script languages) and expressive language with a lot of staff which Lua doesn't have.

I mean:
nice, fast, chainable array methods, and a few characters shortcuts (arrow functions)
Code:
// Javascript
const users = [{id: 1, balance: 100}, {id: 2, balance: 30}, {id: 3, balance: 80}]
users.find(u => u.id == 2).balance += 20;

-- Lua
users = {{id = 1, balance = 100}, {id = 2, balance = 30}, {id = 3, balance = 80}}
for i,u in ipairs(users) do
  if u.id == 2 then users[i].balance = users[i].balance + 20 end
end

Maybe this is stupid example but I like this array methods in JS and also that array are passed by reference.
Creating objects is also very easy (also without classes).

Another advantage of JS is its community and thousands of libraries.

But unfortunately LuaJIT is faster so JS could be(but now it is not possible) only used via NODEJS only as a support for this main technology on server.

But on client you have now JS and you can use it. And when you generate something via .lp file you can via Lua prepare raw data and in JS do most of work.

But also without JS on server I will like LM because this is very, very nice device for creating powerful logic in a lot of powerful waysWink
Done is better than perfect
Reply
#68
(30.10.2018, 15:13)buuuudzik Wrote: You've probably confused threads, but okWink

I very like JS. This is very modern, fast(fast among script languages) and expressive language with a lot of staff which Lua doesn't have.

I mean:
nice, fast, chainable array methods, and a few characters shortcuts (arrow functions)
Code:
// Javascript
const users = [{id: 1, balance: 100}, {id: 2, balance: 30}, {id: 3, balance: 80}]
users.find(u => u.id == 2).balance += 20;

-- Lua
users = {{id = 1, balance = 100}, {id = 2, balance = 30}, {id = 3, balance = 80}}
for i,u in ipairs(users) do
  if u.id == 2 then users[i].balance = users[i].balance + 20 end
end

Maybe this is stupid example but I like this array methods in JS and also that array are passed by reference.
Creating objects is also very easy (also without classes).

Another advantage of JS is its community and thousands of libraries.

But unfortunately LuaJIT is faster so JS could be(but now it is not possible) only used via NODEJS only as a support for this main technology on server.

But on client you have now JS and you can use it. And when you generate something via .lp file you can via Lua prepare raw data and in JS do most of work.

But also without JS on server I will like LM because this is very, very nice device for creating powerful logic in a lot of powerful waysWink
Hi,
Many thanks to Erwin and Buuudzik.
You are wright, may be that is why they introduced the .lp file features in later FW to be able to mix HTML and LUA.

P.S: In this thread, you were talking about your switching to JS, that is why I prefer to post my question here. Smile
B.R,
Chouaibou.
Reply


Forum Jump: