This page last changed on Sep 07, 2013 by moad.

Trying to work out adding rules for XBMC, I am just testing it by adding in a command + sensor to retrieve the volume. I have the regex set (tested and working) as the volume, I have the sensor (TestVolHolder) with a default value and then a second command (Test Message) that is fired.

My rule looks like this

rule

when

Event( source == "TestVolHolder", value == "100" )

then

execute.command( "TestMessage" );

Not only does the rule not work but it also breaks my other sensors?!

Am I missing something?

Cheers,

Nick.

OK so removed the rule and my volume sensor (separate to the test above) was still broken. I then removed the test sensor and my original one worked again.

The original sensor uses the JSONPath to extract the volume, is there some kind of conflict between them?

Edit:

just found this thread...sorry!

http://openremote.org/pages/viewpage.action?pageId=22872779

Posted by moad at Sep 07, 2013 00:21

Thought I'd share this as it took me a little while to figure out and it is still fresh in my mind.

This is just a test so that when I hit 100 volume on xbmc a message displays with the volume level (to begin developing commands based on playerid)

-------------------------------------------------------------------------------------------------------------------------------------------------
package org.openremote.controller.protocol

import org.openremote.controller.model.event.*;

global org.openremote.controller.statuscache.CommandFacade execute;

rule "Range Event Command Execution"

when

$evt: Range ( source == "Display Volume", value == 100 )

then

execute.command ("TestMSG", $evt.getValue());

end

--------------------------------------------------------------------------------------------------------------

I have a command that grabs the current volume from XBMC and uses JSONPATH to extract the result.

Then I created a sensor called "Display Volume" which is a Range from 0 - 100. I use this in a slider on my remote to set the volume as well

Then I created a command called TestMSG which has the message as ${param) - this means it will display the volume value that is pulled from the first command.

Then I entered the rule above, refreshed the controller and voila! A message pops up (with the volume value as the message) when I set the volume in XBMC to 100.

Hope this helps someone! Mods you might like to change the thread title to assist in searching?

Nick.

Posted by moad at Sep 07, 2013 01:45

I've just caused something similar.

My lights have an "On/Off" 'state' and a "Reachable" 'state'.

I've set a sensor for reachability, so that my UI informs a user to turn the mains power onto the device before they can control it (via a label). If I cut mains power, and wait long enough (5-30 seconds, depends on the zigbee polling), the sensor trips and displays the label. This sensor is set to run every 5 seconds.

Separately, I've got an off/off UI switch, which uses the on/off state via a sensor.

I then set a Rule to issue a state -> "Power Off" command, so that the zigbee controller would be updated to an "Off" state, my separate power sensor would then pick up "off" correctly and update the power switch UI. This sensor runs every 1 second.

The FIRST time the rule fires, the label appears and the power switch shows "off".

However, if I then "flick the UI switch", it sends the on command, so the switch UI shows on. However in 5s time, the Reachable sensor should fire and show "No". The label stays on the screen, but the switch stays "on".

So I changed the timings so that reachability sensor ran every 1s, and power state ran every 5s. It still doesn't work....once the switch overrides the state after my rule has run, it never resets.

Clues?

Posted by ptruman at Sep 07, 2013 20:00
Document generated by Confluence on Jun 05, 2016 09:42