Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Creating a rule variable causes 'null' errors #292

Open
Rubidze opened this issue Nov 21, 2018 · 4 comments
Open

Creating a rule variable causes 'null' errors #292

Rubidze opened this issue Nov 21, 2018 · 4 comments

Comments

@Rubidze
Copy link

Rubidze commented Nov 21, 2018

As soon as I add a variable to my rule designer it adds var null LED-status = 0 to the rules file and OpenHAB gives me an error:
[WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model '(5)_nupuga_tuli_vilkuma.rules' has errors, therefore ignoring it: [10,5]: no viable alternative at input 'null' [19,16]: no viable alternative at input '='
image

@ddoll
Copy link

ddoll commented Nov 21, 2018

Maybe try a variable without a minus in it’s name. Don’t know exactly if this could be a problem.
For example: “LED_status” or “LEDstatus”

@Rubidze
Copy link
Author

Rubidze commented Nov 21, 2018

Thanks @ddoll for your input! Changing variable name did not solve the problem, but your suggestion lead me to other ideas to try.

For others who may happen to come across this issue, it appears, we can't use item states (On, Off, Open or Closed) as variables. Using a logic value, such as number (1,2,3,etc.) or boolean (True, False) doesn't try to create a variable called "null" and instead creates a usable variable. OpenHAB doesn't throw described error anymore.

Using boolean will look like this:
image
And variable in a code looks like this:
image

@Rubidze
Copy link
Author

Rubidze commented Nov 21, 2018

@ddoll, I have to add that you are also right about minus in variable name. When changing variable back to include minus, it stopped working. It appears I had two problems. Variable can't have a minus in it and can't use item states as values.

@ddoll
Copy link

ddoll commented Nov 21, 2018

It was my pleasure to help.
Don’t forget to close the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants