MM10
(Michael)
1
Hello,
I have change my OpenHAB from 2.0 to 3.1 and now I will rewrite my rules
Ihav have in OpenHAB 2.0 this rule
rule "heizung_og_sz"
when
Item raumtemp_og_sz_soll changed
then
og_siz_thermostat_soll.sendCommand(raumtemp_og_sz_soll.state as DecimalType)
end
This rule works fine.
Now I habe try this rules in OpenHAB 3.1 in ECMAScript:
events.sendCommand('og_siz_thermostat_soll', raumtemp_og_sz_soll.state as DecimalType);
and
events.sendCommand('og_siz_thermostat_soll', raumtemp_og_sz_soll.state);
and
events.sendCommand('og_siz_thermostat_soll', raumtemp_og_sz_soll);
but nothing works!
What do I wrong?
Thanks’s
Michael
rossko57
(Rossko57)
2
Have you tried sending a string?
Even in DSL, action sendCommand("item","value")
requires two strings.
MM10
(Michael)
3
Hello,
yes, I have tested with a string to a text item and this works fine:
events.sendCommand('test_string', 'Hallo OpenHAB');
rossko57
(Rossko57)
4
alright, let me be more explicit; send a string to any Item type you like.
MM10
(Michael)
5
I am not sure, that I understand your question, but I tried this:
events.sendCommand('og_siz_thermostat_soll', '12');
and this works.
I have look via console, and the item raumtemp_og_sz_soll have a value 14
openhab> openhab:status raumtemp_og_sz_soll
14
rossko57
(Rossko57)
6
Okay, that’s two different Items (siz / sz)
maniac103
(Danny Baumann)
7
How about this?
var item = itemRegistry.getItem('raumtemp_og_sz_soll');
events.sendCommand('og_siz_thermostat_soll', item.getState());
MM10
(Michael)
8
Hello,
thank you, yes, now it works.
Exist a library of code example from OpenHAB3 with ECMAScript?
Where is the syntax definition of ECMA Script?
Thanks