cdjackson / HABmin

A web admin console for openHAB home automation
http://www.cd-jackson.com/index.php/openhab/habmin
217 stars 51 forks source link

rules habmin and habmin2 #227

Open alexeinz opened 9 years ago

alexeinz commented 9 years ago

I have been trying to use the rule designer but any rule I create does not have a trigger. I just dont see how can i add a trigger in a rule like this for example : rule1

------------this is what gets created..... // This rule file is autogenerated by HABmin. // Any changes made manually to this file will be overwritten next time HABmin rules are saved.

// Imports import org.openhab.core.library.types. import org.openhab.core.persistence. import org.openhab.model.script.actions.*

// Global Variables

// Constants used to generate this rule // dist_close == 40

rule "distance light" when then if ((distance_sensor > 40)) { sendCommand(lights_on, ON) } end

cdjackson commented 9 years ago

It should automatically generate the triggers - for example, it should generate a trigger for the distance_sensor - but I think it will only do this if there is a valid item with this name - are the items used here real items or just names you've used for testing?

alexeinz commented 9 years ago

those are valid items


Regards Alex Einz

Listen & Download new music here http://goo.gl/Z8PLo

Tel - +81(0) 80-6749-1800 dj@alexeinz.info

Artist info: http://www.alexeinz.info http://sbstrm.com/alexeinz

Phonika

http://phonikatokyo.com

On Tue, Mar 10, 2015 at 8:08 PM, Chris Jackson notifications@github.com wrote:

It should automatically generate the triggers - for example, it should generate a trigger for the distance_sensor - but I think it will only do this if there is a valid item with this name - are the items used here real items or just names you've used for testing?

— Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin/issues/227#issuecomment-78033906.

cdjackson commented 9 years ago

You’re right - I’ve duplicated your rule so will see if I can fix this…

Cheers Chris

cdjackson commented 9 years ago

So, I double checked, and it works ok. My initial test had an error - I found an error in the name of my item (note that it is case sensitive, as with everything in OH).

For the same rule as yours (but with different items) I get the following rule generated…

I would make sure that your rules are spelt correctly - including case. The giveaway is that the rule hasn’t put .state on the end of the item name - this means it’s not found an item with this name.

Let me know if you find anything - I need to make a proper selection box to select items rather than having to type their name in, but I use this rule editor for all my rules and it’s generated good rules so far (not necessarily the most efficient rule, but ones that work).

// This rule file is autogenerated by HABmin.
// Any changes made manually to this file will be overwritten next time HABmin rules are saved.

// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*

// Global Variables

// Constants used to generate this rule
// Constant == 40

rule "Test"
when
    Item LoungeThermostat_FloorTemp changed
then
  if ((LoungeThermostat_FloorTemp.state == 40)) {
    sendCommand(Lounge_Lights, ON)
  }
end
cdjackson commented 9 years ago

Just wondering if you found the problem with this?

alexeinz commented 9 years ago

sorry didnt have the time to test will try later today and report back

Sent from my iPhone

On Mar 12, 2015, at 4:16 PM, Chris Jackson notifications@github.com wrote:

Just wondering if you found the problem with this?

\ Reply to this email directly or view it on GitHub.

cdjackson commented 9 years ago

Ok - no probs. Just let me know if you want me to look at anything... I need to add something that checks in the client if the item names are correct - or more specifically, allows you to select item names rather than typing them in...

alexeinz commented 9 years ago

I have tried again, this time making sure the names are correct, it did create the trigger but now I have a different issue which I have seen once before too see attached rule image and rule text below this causes java error :

2015-03-13 08:34:24.825 [WARN ] [.o.u.w.i.render.SwitchRenderer] - Cannot determine item type of 'null' org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry at org.openhab.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:80) ~[na:na]


// This rule file is autogenerated by HABmin. // Any changes made manually to this file will be overwritten next time HABmin rules are saved.

// Imports import org.openhab.core.library.types. import org.openhab.core.persistence. import org.openhab.model.script.actions.*

// Global Variables var Timer _timer_001_A = null

// Constants used to generate this rule // highdistance == 120 // lowdistance == 30

rule "kitchen distance" when Item MySENS_Kitchen_dist changed or Item miKitchenstove_sw changed then if (((MySENS_Kitchen_dist.state > 30) && (MySENS_Kitchen_dist.state < 120))) { sendCommand(miKitchenstove_sw, ON) }

if (((miKitchenstove_sw.state == ON) && (MySENS_Kitchen_dist.state > 120))) { if (_timer_001_A == null) { _timer_001_A = createTimer(now.plusMinutes(5)) [| _timer_001_A.cancel() _timer_001_A = null sendCommand(miKitchenstove_sw, OFF) ] } } else if(_timer_001_A != null) { _timer_001_A.cancel() _timer_001_A = null } end


Regards Alex Einz

Listen & Download new music here http://goo.gl/Z8PLo

Tel - +81(0) 80-6749-1800 dj@alexeinz.info

Artist info: http://www.alexeinz.info http://sbstrm.com/alexeinz

Phonika

http://phonikatokyo.com

On Thu, Mar 12, 2015 at 9:44 PM, Chris Jackson notifications@github.com wrote:

Ok - no probs. Just let me know if you want me to look at anything... I need to add something that checks in the client if the item names are correct - or more specifically, allows you to select item names rather than typing them in...

— Reply to this email directly or view it on GitHub https://github.com/cdjackson/HABmin/issues/227#issuecomment-78472470.

alexeinz commented 9 years ago

Strangely enough, when i just create new rule file myself and add the rule as text, it works totally fine.

On Fri, Mar 13, 2015 at 8:38 AM, Alex Einz dj@alexeinz.info wrote:

I have tried again, this time making sure the names are correct, it did create the trigger but now I have a different issue which I have seen once before too see attached rule image and rule text below this causes java error :

2015-03-13 08:34:24.825 [WARN ] [.o.u.w.i.render.SwitchRenderer] - Cannot determine item type of 'null' org.openhab.core.items.ItemNotFoundException: Item 'null' could not be found in the item registry at org.openhab.core.internal.items.ItemRegistryImpl.getItem(ItemRegistryImpl.java:80) ~[na:na]


// This rule file is autogenerated by HABmin. // Any changes made manually to this file will be overwritten next time HABmin rules are saved.

// Imports import org.openhab.core.library.types. import org.openhab.core.persistence. import org.openhab.model.script.actions.*

// Global Variables var Timer _timer_001_A = null

// Constants used to generate this rule // highdistance == 120 // lowdistance == 30

rule "kitchen distance" when Item MySENS_Kitchen_dist changed or Item miKitchenstove_sw changed then if (((MySENS_Kitchen_dist.state > 30) && (MySENS_Kitchen_dist.state < 120))) { sendCommand(miKitchenstove_sw, ON) }

if (((miKitchenstove_sw.state == ON) && (MySENS_Kitchen_dist.state > 120))) { if (_timer_001_A == null) { _timer_001_A = createTimer(now.plusMinutes(5)) [| _timer_001_A.cancel() _timer_001_A = null sendCommand(miKitchenstove_sw, OFF) ] } } else if(_timer_001_A != null) { _timer_001_A.cancel() _timer_001_A = null } end


Regards Alex Einz

Listen & Download new music here http://goo.gl/Z8PLo https://t.yesware.com/tl/594c1c6d92e96a1aad8bf1506098e372c8792b60/0ee4614835b3163ebd7d292f46ac34c6/268796d24dca760c79516979435c60f8?ytl=http%3A%2F%2Fgoo.gl%2FZ8PLo

Tel - +81(0) 80-6749-1800 dj@alexeinz.info

Artist info: http://www.alexeinz.info https://t.yesware.com/tl/594c1c6d92e96a1aad8bf1506098e372c8792b60/0ee4614835b3163ebd7d292f46ac34c6/51f2cff3e43308690ab95a012b9cd2d9?ytl=http%3A%2F%2Fwww.alexeinz.info http://sbstrm.com/alexeinz https://t.yesware.com/tl/594c1c6d92e96a1aad8bf1506098e372c8792b60/0ee4614835b3163ebd7d292f46ac34c6/0937ea1247899605975bfb630a5c9e1b?ytl=http%3A%2F%2Fsbstrm.com%2Falexeinz

Phonika http://phonikatokyo.com

https://t.yesware.com/tl/594c1c6d92e96a1aad8bf1506098e372c8792b60/0ee4614835b3163ebd7d292f46ac34c6/474f1920a19e267faf0ae7c91bfffad9?ytl=http%3A%2F%2Fphonikatokyo.com

On Thu, Mar 12, 2015 at 9:44 PM, Chris Jackson notifications@github.com wrote:

Ok - no probs. Just let me know if you want me to look at anything... I need to add something that checks in the client if the item names are correct - or more specifically, allows you to select item names rather than typing them in...

— Reply to this email directly or view it on GitHub https://t.yesware.com/tl/594c1c6d92e96a1aad8bf1506098e372c8792b60/0ee4614835b3163ebd7d292f46ac34c6/65cc07242ece81fcfd769490d338257e?ytl=https%3A%2F%2Fgithub.com%2Fcdjackson%2FHABmin%2Fissues%2F227%23issuecomment-78472470 .

cdjackson commented 9 years ago

I'm not sure if this is related to the rule directly - the error seems to be coming from sitemap parts of the code. It might still be something to do with the generation of the rule, but it doesn't look like it.