[Labs] Rules

Ah yes, my bad, this takes more sense.

@simondotau Support for HA input_number will be available in the next 7.0 build

1 Like

It’s working, thank you Igor. I noticed that 1 is minimum brightness and 0 appears to return the device to system brightness. Whether this is intentional or a boolean/equality bug, this behaviour is good and should be documented somewhere.

@simondotau that actually sounds like a bug, let me check on it

Rules are going to be such a great feature.

Can a browser also be closed by a rule too?

Many thanks

@Col8 Since open browser action currently opens a standalone browser, the app enters background after that, so it won’t be possible to close browser by a rule.
What is the use case do you have in mind?

Hi Igor

I was thinking that when a motion sensor is triggered I could use a rule to open a browser to view a camera feed. Then when motion ends the browser is closed.

Hi I was able to manage screen ON and OFF but suddendly just screen OFF is working… I am using AMAZON FIRE HD8…any suggestion? thx

@Klaus_Zeller do you mean screen off still works, but screen on does not?
Is the device turned off manually with power button at any time? That would prevent screen on from working.

Yes correct! I do not switch off tablet manually. I am sending the two commanda one after the others… funny thinks is that it worked fine for half a day and now does not wake up anymore… any chance to check some log file report?

@Klaus_Zeller Since it is the labs feature, still experimental, there is no good logs for it yet. It should be improved in the future. I will also double check on fire tablet, see if something is related specifically to those devices.

thx!

Hi Igor, I just made a test to remove installed app (gravity screen) that prevent screen to be re-activated… please close this issue cause it seems working again. THX

@Klaus_Zeller that’s great, thanks for the update!

Looks like something has changed in the rules?
can’t create a new one:

"rules": {
    {
      "name": "Turn Screen ON",
      "condition": {
        "item": "11xveyt45581f1syghbvtxoi79.Tablet01_Screen#switch.state",
        "operator": "eq",
        "value": "on"
      },
      "action": {
        "type": "turn-on-screen"
      }
    },
    "id":{
      "name": "Turn Screen OFF",
      "condition": {
        "item": "11xveyt45581f1syghbvtxoi79.Tablet01_Screen#switch.state",
        "operator": "eq",
        "value": "off"
      },
      "action": {
        "type": "turn-off-screen",
        "binding": null,
        "value": null
      }
    }
  },

Compared to the working rule, the identifier is missing:

"rules": {
    "1rc5aavh5yvf61rucf2aaz98f7": 
    {
      "name": "Turn Screen ON",
      "condition": {

What is the correct syntax to use to create a new rule?

Each rule object should be preceded by identifier. Try this:

  "rules": {
    "rule-screen-on": {
      "name": "Turn Screen ON",
      "condition": {
        "item": "11xveyt45581f1syghbvtxoi79.Tablet01_Screen#switch.state",
        "operator": "eq",
        "value": "on"
      },
      "action": {
        "type": "turn-on-screen"
      }
    },
    "rule-screen-off": {
      "name": "Turn Screen OFF",
      "condition": {
        "item": "11xveyt45581f1syghbvtxoi79.Tablet01_Screen#switch.state",
        "operator": "eq",
        "value": "off"
      },
      "action": {
        "type": "turn-off-screen",
        "binding": null,
        "value": null
      }
    }
  },

Also, make sure there are no errors shown in the editor (red/yellow highlights) for JSON syntax. Since the config won’t be applied if there are errors.

1 Like

Yes! Thank you, it works now. I could not understand what to write here, the description says, when creating a new rule, skip the identifier.
I understand that most likely not, but I will ask :slight_smile:
Is it possible to make a change to items such as screen on, screen off, volume level when changing them from a tablet. Let me explain that the OpenHAB has a ScreenPower item, when I turn it off from the OpenHAB, the tablet screen turns off, but if you turn on the tablet with a physical button on the tablet itself, the OpenHAB will not know that the screen is on and will think that it is off. It would be cool to have some feedback.

Yeah, JSON config format change wasn’t related to the rules, so I forgot to update this post. The rules config was made to be consistent with the other components.

That feature has been on my mind quite a few times. Currently there is no good way to “bind” device behavior back to OH items, since everything is primarily designed for widget-item bindings.
So this might be added in the future, but probably not soon. If there would be a possibility to add it as Labs feature with JSON config only (similar to Rules), that might be earlier.

I’m understood, thank you!

OK, we will wait :slight_smile:

Hi! Is there a way to keep the screen on till a new rule to turn it off is activated?
From the app it’s possible with Stay Awake option. Is possible to control this setting from rules?
Thanks.