13:46:00.770 [DEBUG] [RULES.Heating.PWM.Switch ] - Prefix u4, Item u4_heizung [<type 'unicode'>], State ON [<type 'org.eclipse.smarthome.core.library.types.OnOffType'>]
What is the problem here? The function call works with the same types in another method!?
Full exception trace:
Jan 7 13:38:05 cubietruck karaf[20646]: Traceback (most recent call last):
Jan 7 13:38:05 cubietruck karaf[20646]: File "/etc/openhab2/lib/python/openhab/triggers.py", line 118, in execute
Jan 7 13:38:05 cubietruck karaf[20646]: self.callback(module, inputs) if self.extended else self.callback()
Jan 7 13:38:05 cubietruck karaf[20646]: File "/etc/openhab2/lib/python/openhab/triggers.py", line 162, in callback
Jan 7 13:38:05 cubietruck karaf[20646]: result_value = fn(*fn_args)
Jan 7 13:38:05 cubietruck karaf[20646]: File "<script>", line 112, in switch_pwm
Jan 7 13:38:05 cubietruck karaf[20646]: TypeError: sendCommand(): 1st arg can't be coerced to org.eclipse.smarthome.core.items.Item, String
However, I found that there really is no sendCommand(string, command), only
item, command
item, string
string, string
but no
string, command.
However, I tried all these different variants, but these still result in exceptions after reloading the rule.
I guess that even if the script is reloaded and the problematic function is not called from a timer, the fact that other functions in the script heating.py are called from a running timer, the old script stays in memory for some time?!
After all old timers have finished, the correct variant (now i use item, command) works fine.
Glad this helped! I suggest to use as many Java or OH classes/methods as possible, so that there is less effort when migrating to the scripting API. So…