Looking for rule to count days and do some actions

var currentCounter = 0 // ADD AT TOP OF RULE FILE!!!

rule "increase day counter"
when
//    Time cron "0 1 * ? 0 0 0" // one minute after midnight everyday
         Time cron "0/10 * * ? * * *" // Every 10 seconds
then
    logInfo("Counter State: ", counter.state.toString)

    if (counter.state == NULL) { currentCounter = 0 }     //CHANGED
    else { currentCounter = counter.state as Number }     //CHANGED

    logInfo("CurrentCounter: ". currentCounter.toString)
    currentCounter = currentCounter + 1
    counter.postUpdate(currentCounter)
    if (currentCounter == 7) {
        // DO YOUR STUFF
        V1.sendCommand(ON)
        counter.postUpdate(1) // Or 0 depends when you want to start
    }
end

To be clear, on each update I remove file and create new one :wink:

2018-11-17 21:33:30.015 [INFO ] [arthome.model.script.Counter State: ] - NULL
2018-11-17 21:33:30.029 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'increase day counter': 'currentCounter' is not a member of 'java.lang.String'; line 13, column 13, length 34

Typo
Comma instead of full stop

Line 13

    logInfo("CurrentCounter: ", currentCounter.toString)

Change the first line:

var Number currentCounter = 0 // ADD AT TOP OF RULE FILE!!!