Math operators and Blocking
Moderator: leecollings
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Math operators and Blocking
I've seen in clcky there is no math operators like add, multiply, substract and so.
Because of that we can compare, for example, actual time with sun rise or sunset, but we cannot compare with 1 horu after sunrise or X tima before sunset
I mean:
If I want a trigger at sunrise I use an IF block
if time >= sunrise
do set light = OFF
But if I want to trigger x minutes or hour after sunrise I'de do
IF time >= sunrise + 1hour
DO set light = OFF
With actual blocky I can't do these kind of actions.
Another situation is the use of counter....
Any idea? or the only way is to use scripts?
(I know that I can use timers for simple switches actions, but I'm speaking about more complex situations, and without using scripts)
Thanks
Because of that we can compare, for example, actual time with sun rise or sunset, but we cannot compare with 1 horu after sunrise or X tima before sunset
I mean:
If I want a trigger at sunrise I use an IF block
if time >= sunrise
do set light = OFF
But if I want to trigger x minutes or hour after sunrise I'de do
IF time >= sunrise + 1hour
DO set light = OFF
With actual blocky I can't do these kind of actions.
Another situation is the use of counter....
Any idea? or the only way is to use scripts?
(I know that I can use timers for simple switches actions, but I'm speaking about more complex situations, and without using scripts)
Thanks
-
- Posts: 890
- Joined: Tuesday 30 September 2014 8:49
- Target OS: Linux
- Domoticz version: beta
- Location: The Netherlands
- Contact:
Re: Math operators and Blocking
I think you will need Lua scripting for that.
I am not active on this forum anymore.
- Domosapiens
- Posts: 232
- Joined: Wednesday 20 August 2014 12:08
- Target OS: Windows
- Domoticz version: V3.5981
- Location: NL
- Contact:
Re: Math operators and Blocking
I vote for Subtract and Add in Blockly.
And with a result that also can be written to a Dummy Sensor.
A necessity for deltaT calculation and hysteresis setting in heating solutions.
Hope the development team can find some time ...
Regards
Domosapiens
And with a result that also can be written to a Dummy Sensor.
A necessity for deltaT calculation and hysteresis setting in heating solutions.
Hope the development team can find some time ...
Regards
Domosapiens
Win Vista&7; 1#Aeon Z-Stick S2; 1#Aeotec Z-Sick Gen5, 6#Fib.FGBS001; 24#DS18B20; 8#Everspr.AN158-2; 3#Philio PAN04; 1#Philio PAN06, 1#YouLess El; 1#Fib.FGWPE; 1#ZME_RC2; 2#FAK_ZWS230, 2#Quib.ZMNHCDx, 1#Quib.ZMNHDD1, 7#EM6555
-
- Posts: 1
- Joined: Sunday 25 January 2015 2:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Math operators and Blocking
In your switch configuration menu you can schedule On/Off and compare +/- minutes before or after sunrise (sunset). Sorry for the translation I'm using the french version
- mongoose
- Posts: 42
- Joined: Friday 22 November 2013 10:43
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Math operators and Blocking
Yes you could change a dummy switch to go on or off before sunset/rise and then use that in blocky for more complex operations or check out how to do it in lua script...
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Math operators and Blocking
Very clever
Thanks
That is an elegant solution!!! I'll try itmongoose wrote:Yes you could change a dummy switch to go on or off before sunset/rise and then use that in blocky for more complex operations or check out how to do it in lua script...
Thanks
-
- Posts: 2
- Joined: Monday 13 April 2015 10:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Math operators and Blocking
I also want to use math operators in blockly. I want to calculate a DeltaHumidity: the difference between the outside humidity (from a weather station nearby) and the humidity in my bathroom. This to switch my ventilation. ANy clue how to do that in Blockly?
pi1 with Domoticz and RFXtrx433E USB reciever, 6*Switch Action (Eurodomest) Humidity/Temperature sensor Alecto WS-1700, KiKa ACM-3500-3 to switch Ventilation
Pi2 with Kodi
Pi2 with Kodi
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Math operators and Blocking
I have no solution for you, but just wondering if you are trying to do the right thing. Relative humidity is relative to the temperature. You need to calculate back to 1 temperature for both sensor results to do a correct comparisonewezel wrote:I also want to use math operators in blockly. I want to calculate a DeltaHumidity: the difference between the outside humidity (from a weather station nearby) and the humidity in my bathroom. This to switch my ventilation. ANy clue how to do that in Blockly?
-
- Posts: 2
- Joined: Monday 13 April 2015 10:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: The Netherlands
- Contact:
Re: Math operators and Blocking
I want to switch on the ventilator if the internal humidity is more than 10% higher than the outside humidity. I do not care about the temperature. Normally the difference between the in house humidity and the outside humidity is 2 or 3%.jake wrote:I have no solution for you, but just wondering if you are trying to do the right thing. Relative humidity is relative to the temperature. You need to calculate back to 1 temperature for both sensor results to do a correct comparisonewezel wrote:I also want to use math operators in blockly. I want to calculate a DeltaHumidity: the difference between the outside humidity (from a weather station nearby) and the humidity in my bathroom. This to switch my ventilation. ANy clue how to do that in Blockly?
pi1 with Domoticz and RFXtrx433E USB reciever, 6*Switch Action (Eurodomest) Humidity/Temperature sensor Alecto WS-1700, KiKa ACM-3500-3 to switch Ventilation
Pi2 with Kodi
Pi2 with Kodi
-
- Posts: 742
- Joined: Saturday 30 May 2015 22:40
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Contact:
Re: Math operators and Blocking
I understand that you don't care about temperature, but it is called relative humidity for a reason. When it is cold outside, the relative humidity can be sky high, but the air can still be very useful to dry your humid bath room. When comparing humidity between two environments, you n need to recalculate to 1 temperature to make sense. RH itself is only a percentage, see Wikipedia
But, on topic, I don't think you can succeed with blockly, only when you want to act on equal, smaller or bigger values.
But, on topic, I don't think you can succeed with blockly, only when you want to act on equal, smaller or bigger values.
-
- Posts: 39
- Joined: Sunday 10 January 2016 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Cherbourg - Caen | France
- Contact:
Re: Math operators and Blocking
Hye everybody,
Its strange as blockly is supporting natively the maths and loops operation as seen on there website: https://developers.google.com/blockly/
and on this screenshot:

Any ideas how to activate this two missing "library"?
Its strange as blockly is supporting natively the maths and loops operation as seen on there website: https://developers.google.com/blockly/
and on this screenshot:

Any ideas how to activate this two missing "library"?
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Math operators and Blocking
Interesting, I'd like this option too.!!
-
- Posts: 221
- Joined: Saturday 30 August 2014 20:20
- Target OS: Linux
- Domoticz version: 4.
- Location: Spain
- Contact:
Re: Math operators and Blocking
After I worked deeper with Blockly, I think that it needs more that just mathematic operators. In my opinion Blockly is far awway from Lua scripts. Perhaps if a trnaslator to Lua were added to the Blockly editor.
Blockly is poerful, but it's just an editor. For more you can see https://developers.google.com/blockly/g ... tarted/web
Blockly is poerful, but it's just an editor. For more you can see https://developers.google.com/blockly/g ... tarted/web
- tommit01
- Posts: 39
- Joined: Friday 12 July 2013 14:08
- Target OS: Raspberry Pi / ODroid
- Domoticz version: multiple
- Location: Germany / SL
- Contact:
Re: Math operators and Blocking
Now Blockly has a LUA translator/generator..
I think now only reference to C++ has to be realized
see here:
https://blockly-demo.appspot.com/static ... index.html
BR
Tommit
I think now only reference to C++ has to be realized
see here:
https://blockly-demo.appspot.com/static ... index.html
BR
Tommit
1 x RPi3
4 x RPI
3 x RPi2
1 x RPI2 + Win 10 IoT (experimental device)
2 x RPI2 Raspbian "Jessie" + Domoticz (for tenants)
2 x RPI OSMC @ 1GHz
1 RPi Zero W + Cam NOIR
1 RPi Zero W + Cam
RFXtrx 433 FW 1015
RFXtrx 433 E FW 1020
4 x RPI
3 x RPi2
1 x RPI2 + Win 10 IoT (experimental device)
2 x RPI2 Raspbian "Jessie" + Domoticz (for tenants)
2 x RPI OSMC @ 1GHz
1 RPi Zero W + Cam NOIR
1 RPi Zero W + Cam
RFXtrx 433 FW 1015
RFXtrx 433 E FW 1020
-
- Posts: 5
- Joined: Monday 07 March 2016 21:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Math operators and Blocking
No news about Math functions implementation ???
Thanks
Thanks
-
- Posts: 39
- Joined: Sunday 10 January 2016 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Cherbourg - Caen | France
- Contact:
-
- Posts: 39
- Joined: Sunday 10 January 2016 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Cherbourg - Caen | France
- Contact:
Re: Math operators and Blocking
I think I got it working. Will post later but 
Sent from my MI MAX using Tapatalk

Sent from my MI MAX using Tapatalk
Re: Math operators and Blocking
Please! Can you PM me what files you moddified in Domoticz to get open up math? I tried myself and found some references in the www folder but without success.
-
- Posts: 39
- Joined: Sunday 10 January 2016 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.3530
- Location: Cherbourg - Caen | France
- Contact:
Re: Math operators and Blocking
Just change the file toolbox.xml file. It's attached
- Attachments
-
- toolbox.xml
- (2.5 KiB) Downloaded 842 times
Who is online
Users browsing this forum: No registered users and 1 guest