# Lambda Reference Problem?

**URL:** <https://community.openhab.org/t/lambda-reference-problem/18747>\
**Category:** Scripts & Rules\
**Tags:** lambda, state, xfeaturecallimplcust\
**Created:** [December 25, 2016, 2:31pm UTC](https://community.openhab.org/t/lambda-reference-problem/18747 "2016-12-25T14:31:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![muetze303](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@muetze303](https://community.openhab.org/u/muetze303)\
**Post date:** [December 25, 2016, 2:31pm UTC](https://community.openhab.org/t/lambda-reference-problem/18747/1 "2016-12-25T14:31:54Z")

</div>

Hello,

I’m trying to simplify my rules with use of a lambda expression:

```php
val org.eclipse.xtext.xbase.lib.Functions$Function1 alarmInnenLogic = [
    org.openhab.core.library.items.ContactItem contactItem|

        logInfo("Homematic", "!!!!! Start EG_Buero_Fenster_1_State REACHABLE" ) // ok

        if (contactItem.state == OPEN){ // Error - "The name '<XFeatureCallImplCustom>.state' cannot be resolved to an item or type"
                logInfo("Homematic", "!!!!!!!!!!!! EG_Buero_Fenster_1_State OPEN" )
                sendCommand(Sirene_Innen_1_State, ON)
        } else {
                logInfo("Homematic", "!!!!!!!!!!!! EG_Buero_Fenster_1_State CLOSED" )
                sendCommand(Sirene_Innen_1_State, OFF)
        }

]

rule "Alarm einschalten per Logic"
when Item EG_Buero_Fenster_1_State received update
then
  logInfo("Homematic","!!!!" + EG_Buero_Fenster_1_State.state)
  alarmInnenLogic.apply(EG_Buero_Fenster_1_State)
end

```

Unfortunatly I always get the following error message:

```php
2016-12-25 15:23:54.575 [INFO] [pse.smarthome.model.script.Homematic] - !!!!CLOSED
2016-12-25 15:23:54.587 [INFO] [pse.smarthome.model.script.Homematic] - !!!!! Start EG_Buero_Fenster_1_State REACHABLE
2016-12-25 15:23:54.603 [ERROR] [.script.engine.ScriptExecutionThread] - Rule 'Alarm einschalten per Logic': The name '<XFeatureCallImplCustom>.state' cannot be resolved to an item or type.

```

It seems to me that outside of the lambda expressin everything ist ok, but when the code reaches the lambda expression ‘state’ is somehow incorrect …

Any Ideas what am I doing wrong?

Thanks in advance and merry christmas!

Best Regards,

Muetze303

---

<div class="post-metadata">

**Author:** ![muetze303](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/ecc23a/32.png) [@muetze303](https://community.openhab.org/u/muetze303)\
**Post date:** [December 27, 2016, 5:08pm UTC](https://community.openhab.org/t/lambda-reference-problem/18747/2 "2016-12-27T17:08:32Z")

</div>

Ok, the Probelm was a wrong Package Name.

It has to be

```php
org.eclipse.smarthome.core.library.items.ContactItem

```

instead of

```php
org.openhab.core.library.items.ContactItem

```
