Simple rule question

I am working with OpenHAB for years now, but every once in a while, I loose an hair on the rule engine. Right now, this is such a moment and I would be thankful if somebody can have a quick look, please?

Switch						Basement_Switch_Door_Switch								"Steckdose Eingang Ein / Ausschalten [%s]"							<power>		(G_Basement_Switch_Door)													

Switch						Basement_CeilingLightLeft_Switch						"Linkes Kellernlicht"												<light>		(G_Basement_LightsSwitches, G_Basement_CeilingLightLeft)	[ "Lighting" ]		
Switch						Basement_CeilingLightRight_Switch						"Rechtes Kellernlicht"												<light>		(G_Basement_LightsSwitches, G_Basement_CeilingLightLeft)	[ "Lighting" ]	{channel="zwave:device:ef00bd02:node10:switch_binary1"}
rule "Light switches in basement"
when 
    Item Basement_Switch_Door_Switch changed
then 
    Basement_CeilingLightLeft_Switch.sendCommand(Basement_Switch_Door_Switch.state)
    Basement_CeilingLightRight_Switch.sendCommand(Basement_Switch_Door_Switch.state)
end 
2020-04-14 20:25:16.369 [ome.event.ItemCommandEvent] - Item 'Basement_Switch_Door_Switch' received command OFF

2020-04-14 20:25:16.370 [vent.ItemStateChangedEvent] - Basement_Switch_Door_Switch changed from ON to OFF

==> /var/log/openhab2/openhab.log <==

2020-04-14 20:25:16.371 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Light switches in basement': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.Number) on instance: null

==> /var/log/openhab2/events.log <==

2020-04-14 20:25:17.557 [ome.event.ItemCommandEvent] - Item 'Basement_Switch_Door_Switch' received command ON

2020-04-14 20:25:17.560 [vent.ItemStateChangedEvent] - Basement_Switch_Door_Switch changed from OFF to ON

==> /var/log/openhab2/openhab.log <==

2020-04-14 20:25:17.560 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Light switches in basement': An error occurred during the script execution: Could not invoke method: org.eclipse.smarthome.model.script.actions.BusEvent.sendCommand(org.eclipse.smarthome.core.items.Item,java.lang.Number) on instance: null

Thanks a lot!
PhiL

Try changing

Basement_CeilingLightLeft_Switch.sendCommand(Basement_Switch_Door_Switch.state)

to

Basement_CeilingLightLeft_Switch.sendCommand(Basement_Switch_Door_Switch.state.toString)
1 Like

Yes, that does work, thank you - but why? they are all type Switch, a simple “.state” should be enough for my understanding.

states are not the same as commands. While it’s more obvious with examples like command UP and state 80%, it still holds true for state ON and command ON