Error in rule based on state of a sensor

Hi I have a rule to turn on and off at a certain time I work well, I searched the network and using the Openhab interface to create rules I created this so that the light is turned on at a certain value of a sensor but nothing is very simple…

import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
rule "luces on"
when
Time cron "0 30 21 ? * *"
then
SimpleLight7.sendCommand(ON)
end

rule "luces off"
when
Time cron "0 00 02 ? * *"
then
SimpleLight7.sendCommand(OFF)
end
rule "luces terraza"
when
item luminosidad1 changed
then
if(luminosidad1.state <=8) {
Simplelight0.sendCommand(ON)
}
if(luminosidad1.state >8) {
Simplelight0.sendCommand(OFF)
}
end

Thank you
Pd.- apologize for my english use google translate

It helps a lot to use code fences when posting code:

```
your rule code goes here
```

Are there errors in your logs? If it is complaining about Numbers then you need to cast the state of luminosidad1 to a Number before the comparison to 8.

if(luminosidad1.state as Number <= 8)

Hello understood the quotation marks

I have checked the logs and apparently do not give any error

2017-08-01 22:59:45 - Simplelight0 state updated to OFF
2017-08-01 22:59:45 - luminosidad1 state updated to 0.7001953

I do not understand why it does not work

a greeting

Thank you
Pd.- apologize for my english use google translate

Add logging to see if the rules are triggering.

Add the as Number to the if checks just to rule that out as a problem.

Hello, which of all these files that come out, greetings

Hello, I do not know if it helps but I work with OH 1.8 that I have not said at any time

openhab.log contains the logs you want.

I don’t remember where the file to configure logging is in 1.8 so can’t help with that.