Closed lewie closed 4 years ago
When I try to use a Location item with a perfectly valid lat,lon string of the form "99.9999999,-99.9999999" it logs this:
[WARN ] [ore.internal.items.ItemUpdater] - InstantiationException on org.openhab.core.library.types.PointType
(1.7.1 core and bindings). If I change the item to a String item, I see its value correctly.
Hello @watou, yes, something goes wrong with these items?
@teichsta: Do "Location" and "Call" have a future in OpenHab1/2?
Some Tests in OpenHab 1:
Call Call_Item (All)
Location Location_Item (All)
import org.openhab.core.library.types.*
import org.openhab.library.tel.items.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.openhab.core.library.items.LocationItem
import org.openhab.library.tel.types.CallType
import org.openhab.library.tel.items.CallItem
rule "Location_Item Demo"
when
Time cron "0/5 * * * * ?"
then
var PointType t1 = new PointType("49.71721,11.13682")
var PointType t2 = new PointType("52.5200066,13.4049540")
logInfo("Location_Item:"," Location_Item= "+Location_Item)
logInfo("Location_Item:"," t1: "+t1.toString())
logInfo("Location_Item:"," t2: "+t2.toString())
postUpdate("Location_Item",t1)
sendCommand("Location_Item",t2)
end
rule "Call_Item Demo"
when
Time cron "3/5 * * * * ?"
then
var CallType c1 = new CallType("091916255252##01792239944")
var CallType c2 = new CallType("091916255254##01792239946")
logInfo("Call_Item:"," Call_Item= "+Call_Item)
logInfo("Call_Item:"," c1: "+c1.toString())
logInfo("Call_Item:"," c2: "+c2.toString())
postUpdate("Call_Item",c1)
sendCommand("Call_Item",c2)
end
15:25:58.002 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53 ] - Executing scheduled rule 'Call_Item Demo'
15:25:58.051 [INFO ] [penhab.model.script.Call_Item::53 ] - Call_Item= Call_Item (Type=CallItem, State=Uninitialized)
15:25:58.077 [INFO ] [penhab.model.script.Call_Item::53 ] - c1: 01792239944##091916255252
15:25:58.100 [INFO ] [penhab.model.script.Call_Item::53 ] - c2: 01792239946##091916255254
15:25:58.160 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob:57 ] - Error during the execution of rule Call_Item Demo
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,org.openhab.core.types.State) on instance: null
at org.eclipse.xtext.xb...
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMeth...
15:26:00.001 [DEBUG] [.o.m.r.i.engine.ExecuteRuleJob:53 ] - Executing scheduled rule 'Location_Item Demo'
15:26:00.006 [INFO ] [.o.model.script.Location_Item::53 ] - Location_Item= Location_Item (Type=LocationItem, State=Uninitialized)
15:26:00.008 [INFO ] [.o.model.script.Location_Item::53 ] - t1: 49,72°N, 11,14°W, 0,00 m
15:26:00.010 [INFO ] [.o.model.script.Location_Item::53 ] - t2: 52,52°N, 13,40°W, 0,00 m
15:26:00.016 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob:57 ] - Error during the execution of rule Location_Item Demo
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,org.openhab.core.types.State) on instance: null
at org.eclipse.xtext.xbas...
Caused by: java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.Nat...
Rgds Helmut
Hi,
So, are they deprecated or is there another reason for there hide and seek. ;-)
no, both types are valid and not deprecated! If they are not working i would consider this a critical bug.
Note: there are ongoing discussion about the purpose and in depth implementation of the CallItem/Type in ESH (see https://github.com/eclipse/smarthome/pull/236). Any chance to investigate what the problem could be?
Best, Thomas E.-E.
@lewie, I changed your rules from postUpdate("item", state)
to item.postUpdate(state)
and I saw no failures in the log:
2015-08-31 21:36:55.013 [INFO ] [.o.model.script.Location_Item:] - Location_Item= Location_Item (Type=LocationItem, State=49.72°N, 11.14°W, 0.00 m)
2015-08-31 21:36:55.019 [INFO ] [.o.model.script.Location_Item:] - t1: 49.72°N, 11.14°W, 0.00 m
2015-08-31 21:36:55.023 [INFO ] [.o.model.script.Location_Item:] - t2: 52.52°N, 13.40°W, 0.00 m
2015-08-31 21:36:58.012 [INFO ] [penhab.model.script.Call_Item:] - Call_Item= Call_Item (Type=CallItem, State=01792239946##091916255254)
2015-08-31 21:36:58.016 [INFO ] [penhab.model.script.Call_Item:] - c1: 01792239944##091916255252
2015-08-31 21:36:58.020 [INFO ] [penhab.model.script.Call_Item:] - c2: 01792239946##091916255254
I don't know why passing the item name instead as the first argument doesn't work in these cases.
Also, I can see in the code that sendCommand("Location_Item",t2)
or Location_Item.sendCommand(t2)
won't work because LocationItems do not accept Commands, so I commented out that line.
won't work because LocationItems do not accept Commands, so I commented out that line.
good catch! I didn't know that by now :-) I would consider this as flaw since it should be possible to send a location command to e.g. a lawn mower to the autonomously driving car, etc. …
Agreed; PointType ought to be an acceptedCommandType for LocationItems. Should I make a PR to add that?
I also think I just noticed why I could not post an update to the LocationItem -- PointType does not have a zero-arg constructor; all types need a zero-arg ctor per this line.
@watou @teichsta I'm reviewing open critical bug reports. It looks like merged PR #3104 partially fixes this issue. Can someone summarize what remains to be fixed and if that is still a critical bug? Thanks.
@lewie could you please summarise if and what is still open here?
@lewie any chance to have a look at this one in the coming days?
Hello @teichsta and all, Merry Christmas :-)
tested in 1.8 SNAPSHOT:
DEFAULT RULES: Both, Location and Call Items are working with style item.postUpdate(state) item.sendCommand(state)
Get Errors for both Location and Call Items with style postUpdate("item", state) sendCommand("item", state)
Errors:
2015-12-26 17:28:50.065 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob] - Error during the execution of rule Call_Item Demo1
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null
...
2015-12-26 17:36:10.009 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob] - Error during the execution of rule Call_Item Demo1
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.String) on instance: null
...
2015-12-26 17:29:00.075 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob] - Error during the execution of rule Location_Item Demo1
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.postUpdate(org.openhab.core.items.Item,java.lang.Number) on instance: null
...
2015-12-26 17:40:40.056 [ERROR] [.o.m.r.i.engine.ExecuteRuleJob] - Error during the execution of rule Location_Item Demo1
java.lang.IllegalStateException: Could not invoke method: org.openhab.model.script.actions.BusEvent.sendCommand(org.openhab.core.items.Item,java.lang.String) on instance: null
...
Used Rules:
rule "Location_Item Demo1"
when
Time cron "0/20 * * * * ?"
then
var PointType t1 = new PointType("39.71721,21.13682")
var PointType t2 = new PointType("52.5200066,13.4049540")
postUpdate("Location_Item",t1)
sendCommand("Location_Item",t2)
end
rule "Location_Item Demo2"
when
Time cron "5/20 * * * * ?"
then
var PointType t1 = new PointType("39.71721,21.13682")
var PointType t2 = new PointType("52.5200066,13.4049540")
Location_Item.postUpdate(t1)
Location_Item.sendCommand(t2)
end
rule "Call_Item Demo1"
when
Time cron "10/20 * * * * ?"
then
var CallType c1 = new CallType("0232323232352##05454545454")
var CallType c2 = new CallType("0232323232354##05454545456")
postUpdate("Call_Item",c1)
sendCommand("Call_Item",c2)
end
rule "Call_Item Demo2"
when
Time cron "15/20 * * * * ?"
then
var CallType c1 = new CallType("0232323232352##05454545454")
var CallType c2 = new CallType("0232323232354##05454545456")
Call_Item.postUpdate(c1)
Call_Item.sendCommand(c2)
end
JSR223 RULES: Get Errors with call Item: seems to be a classloader problem with org.openhab.library.tel.types.CallType
2015-12-26 17:44:00.065 [WARN ] [.c.i.events.EventPublisherImpl] - given new state is NULL, couldn't post update for 'Call_Item'
2015-12-26 17:44:00.065 [WARN ] [.c.i.events.EventPublisherImpl] - given command is NULL, couldn't send command to 'Call_Item'
Used JS script:
var itemTypeLocationCall = new Rule(){
getEventTrigger: function(){
return [
new TimerTrigger("0 0/1 * * * ?")
];
},
execute: function(event){
var p = new PointType(new DecimalType(49.71721), new DecimalType(11.13682));
be.postUpdate("Location_Item",p);
var p = new PointType(new DecimalType(59.71721), new DecimalType(21.13682));
be.sendCommand("Location_Item",p);
var c = new CallType("091916255250##01792239943");
be.postUpdate("Call_Item",c);
var c = new CallType("091916255250##01792239944");
be.sendCommand("Call_Item",c);
}
};
function getRules(){return new RuleSet([itemTypeLocationCall]);}
thanks for this update @lewie … so still something left to do unfortunately!
Oh, sorry @teichsta, I just noticed this.
Can not do it jet. Or in other words, it would take too long to incorporate me to dive deep.
For DEFAULT RULES: and its writing style problem, I think we need a xText specialist. For LocationItem I do not know what to do yet.
For CallItem the first thing I think, is to integrate it correct: One of the reasons is certainly that:
org.openhab.library.tel.types.CallType should move to other Types org.openhab.core.library.types.CallType
org.openhab.library.tel.items.CallItem should move to other Item Classes org.openhab.core.library.items.CallItem and org.openhab.library.tel.TelItemFactory should move to org.openhab.core.library.TelItemFactory
But of this, these bundles are affected: org.openhab.binding.asterisk org.openhab.binding.freeswitch org.openhab.binding.fritzbox org.openhab.binding.fritzboxtr064 org.openhab.core.compat1x org.openhab.core.jsr223 org.openhab.library.tel org.openhab.persistence.jpa
Hmm...
Helmut
Since the core is no longer here, should we create a new issue for this in ESH?
( @watou, @lewie )
Closing due to inactivity
Hello, I can find Information about "Location" and "Call" in Sourcecode, but not in Wiki: https://github.com/openhab/openhab/wiki/Explanation-of-items#itemtype
So, are they deprecated or is there another reason for there hide and seek. ;-)
I am working at a new Bundle so I need to know about.
Thanks Helmut