Transfer rule from OpenHab2 to OpenHAB3 ECMA: Not work

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

Have you tried sending a string?
Even in DSL, action sendCommand("item","value") requires two strings.

Hello,

yes, I have tested with a string to a text item and this works fine:

events.sendCommand('test_string', 'Hallo OpenHAB');

alright, let me be more explicit; send a string to any Item type you like.

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

Okay, that’s two different Items (siz / sz)

How about this?

var item = itemRegistry.getItem('raumtemp_og_sz_soll');
events.sendCommand('og_siz_thermostat_soll', item.getState());

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