Autowarm (CLOSED)

it seems to work if you just create a blank txt document with append .rules i can live with that thanks for your help i have alot of light rules to sort now im doing lighs because the rules are simple

Can you add notes and descriptions to your rules

I have been using this command too turn off my hue colour light

sendCommand( BULB6LRMAIN1_Color, 63,3,0)

i would like to be able to add a only if light is not already set at 100 brightness that would be

63,3,100

but if somone changed the color of the bulb the first two numbers would be different so i cant use

if =63,3,100

is there a wildcard option like

if =*,*,100

Try this Code :slight_smile:

rule "RGB"
when
  Item your_item changed
then
  var HSBType currentState
  currentState = BULB6LRMAIN1_Color.state
  var PercentType bright = currentState.getBrightness()
  if (bright != 100) {
    sendCommand( BULB6LRMAIN1_Color, 63,3,0)
  }
end

I will try more tomorrow now i have been trying to get this rule to work for ages its supposed to set the main light to a warm colour but only if its not set on bright white full brightness and movie mode is not enabled.

i just cant get it to work i have tried as many variations as i can think of but i think im just not skilled enought to understand whats wrong yet i just keep getting errors on KARAF console

rule "Auto Warm"
when
  Time cron "	0 0 22 1/1 * ? *"
then
if (Movie_Mode_Trigger.state == OFF) {
  if (BULB6LRMAIN1_Color.state != 63,3,100) {
    BULB6LRMAIN1_Color.sendCommand(29,100,48)
  }
}
end
00:16:41.137 [WARN ] [.core.internal.folder.FolderObserver] - Error while opening file during update: C:\Users\Sharpy\DOWNLO~1\OPENHA~1.0\conf\rules\Untitled-1.rules
00:16:41.436 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'Untitled-1.rules'
00:16:41.437 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Untitled-1.rules' is either empty or cannot be parsed correctly!
00:16:41.448 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'Untitled-1.rules' has errors, therefore ignoring it: [6,37]: mismatched input ',' expecting ')'
[6,39]: mismatched input ',' expecting '}'
[6,43]: mismatched input ')' expecting 'end'

Thanks for all your help you have helped me get quite a few rules transfered to text based ones its nearly bed time so will read this again and try again tomorrow now

this line has Errors :wink:

if (BULB6LRMAIN1_Color.state != "63,3,100") {

I think so is right :wink:

1 Like

i will try before i go bed its a quick change if it works i can kick myself in my dreams lol

the rule was accepted after your edit :slight_smile: making me feel stupid lol :wink:

the rule ran but seemed to have a strange outcome like it changed the wrong value or only accepted the first digit of the 3 i will update tomorrow now

00:37:12.468 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'BULB6LRMAIN1_Color' received command 63,3,100
00:37:12.468 [INFO ] [marthome.event.ItemStateChangedEvent] - BULB6LRMAIN1_Color changed from 63,3,29 to 63,3,100
00:37:19.756 [INFO ] [marthome.event.ItemStateChangedEvent] - Plug5AMP_Signal changed from -45 to -46
00:37:19.955 [INFO ] [marthome.event.ItemStateChangedEvent] - Plug2_Signal changed from -51 to -50
00:37:19.955 [INFO ] [marthome.event.ItemStateChangedEvent] - Plug3_Signal changed from -44 to -47
00:37:20.648 [INFO ] [marthome.event.ItemStateChangedEvent] - PLUG6TylerSTV_Signal changed from -57 to -56
00:37:49.797 [INFO ] [marthome.event.ItemStateChangedEvent] - Plug5AMP_Signal changed from -46 to -47
00:37:49.992 [INFO ] [marthome.event.ItemStateChangedEvent] - Plug2_Signal changed from -50 to -53
00:37:50.688 [INFO ] [marthome.event.ItemStateChangedEvent] - PLUG6TylerSTV_Signal changed from -56 to -58
00:38:00.046 [INFO ] [smarthome.event.ItemCommandEvent    ] - Item 'BULB6LRMAIN1_Color' received command 29
00:38:00.046 [INFO ] [marthome.event.ItemStateChangedEvent] - BULB6LRMAIN1_Color changed from 63,3,100 to 63,3,29

This must be work :slight_smile:

rule "Auto Warm"
when
  Time cron "	0 0 22 1/1 * ? *"
then
  if (Movie_Mode_Trigger.state == OFF) {
    if (BULB6LRMAIN1_Color.state instanceof HSBType) {
      var HSBType currentState
      currentState = BULB6LRMAIN1_Color.state
      var DecimalType hue = currentState.getHue()
      var PercentType sat = currentState.getSaturation()
      var PercentType bright = currentState.getBrightness()
      if ( hue != 63 && sat != 3 && bright != 100 ) BULB6LRMAIN1_Color.sendCommand(29,100,48)
    }
  }
end

im back thanks for that i will try now and get post back

i copied the rule exactly how you said just changed the cron time

rule "Auto Warm"
when
  Time cron "	0 6 14 1/1 * ? *"
then
  if (Movie_Mode_Trigger.state == OFF) {
    if (BULB6LRMAIN1_Color.state instanceof HSBType) {
      var HSBType currentState
      currentState = BULB6LRMAIN1_Color.state
      var DecimalType hue = currentState.getHue()
      var PercentType sat = currentState.getSaturation()
      var PercentType bright = currentState.getBrightness()
      if ( hue != 63 && sat != 3 && bright != 100 ) BULB6LRMAIN1_Color.sendCommand(29,100,48)
    }
  }
end

movie mode was off and the bulb was also off but nothing happened after cron time

Try this … the sendCommand was wrong … I just copy it :wink:

rule "Auto Warm"
when
  Time cron "0 0 22 1/1 * ? *"
then
  if (Movie_Mode_Trigger.state == OFF) {
    if (BULB6LRMAIN1_Color.state instanceof HSBType) {
      var HSBType currentState
      currentState = BULB6LRMAIN1_Color.state
      var DecimalType hue = currentState.getHue()
      var PercentType sat = currentState.getSaturation()
      var PercentType bright = currentState.getBrightness()
      if ( hue != 63 && sat != 3 && bright != 100) {
        BULB6LRMAIN1_Color.sendCommand(new HSBType(new DecimalType(29), new PercentType(100), new PercentType(48)))
      }
    }
  }
end

i did have a try of this but was busy yesterday it didn’t seem too work will try again after running some backups

i have tried this a few times now same response nothing happens

i have tried with the light off nothing happens
i have tried with the light set to a random colour nothing changes

im not sure whats wrong

after more learning im assuming that the early versions of this rule that you sent me where it just set the light to white instead of a colour in error it was caused by the quote marks not being in the send command i cant check as you edited over the older version of the rule