I am struggling with rules - and maybe I am simply not reading the right (parts) of the documentation. At startup I would like to sum up 2 item value into a new item:
I retrieve data from Stiebel Eltron LWZ403 using the Modbus Binding.
Item PWWSUMME1 is holding the energy created in kWh, eg 412
Item PWWSUMME2 is holding the energy created in MWh, eg 15
To get to the total of 15.412 kWh I want to multiply PWWSUMME2 by 1000 and add PWWSUMME1 followed by saving that new value into a virtual item PWWSUMME
// Set WWALARM to off = 0
// Calc PWWSUMME & PHEIZENSUMME
var num1 = PWWSUMME1.state
var num2 = PWWSUMME2.state
var num3 = (num2 * 1000 + num1)
PWWSUMME.state = num3
However, I receive the following error
Error during the execution of startup rule ‘INIT’: Unknown variable or command ‘*’; line 11, column 14, length 11
Help is being appreciated a lot If anyone knows really good tutorial for how to write code within rules, I would be really thankful. I can generally code (Java, Python, PHP, AngularJS,…) but need to get familiarized with the Syntax and commands I am allowed to use in OH2.4 rules (and honestly I did not find the official documentation too helpful).