Enigma2 Binding

(Hallo Ween) #88

I´m no script professional :frowning:

Please can you add this to your script from the post above?

It doesn´t matter, if the receiver is off or in deep standby. When there is no connection, i want to get it shown as off.

With the current script i get many errors in openhab.log.

0 Likes

(Kevin) #89

Yes I can add it later (tonight)… post your Errors in Logfile :slight_smile:

0 Likes

(Hallo Ween) #90

If i execute the script with the value getPowerState, then i get this:

(if i only execute the script with no value at the end of the command line, only the first line of the error is shown in the log “file or directory not found…”)

018-01-29 15:26:29.637 [ERROR] [lipse.smarthome.io.net.exec.ExecUtil] - couldn't execute commandLine '/etc/openhab2/scripts/enigma.sh getPowerState'

java.io.IOException: Cannot run program "/etc/openhab2/scripts/enigma.sh": error=2, Datei oder Verzeichnis nicht gefunden

	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:?]

	at java.lang.Runtime.exec(Runtime.java:620) ~[?:?]

	at java.lang.Runtime.exec(Runtime.java:450) ~[?:?]

	at java.lang.Runtime.exec(Runtime.java:347) ~[?:?]

	at org.eclipse.smarthome.io.net.exec.ExecUtil.executeCommandLine(ExecUtil.java:65) ~[?:?]

	at org.eclipse.smarthome.model.script.actions.Exec.executeCommandLine(Exec.java:43) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]

	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]

	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]

	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1085) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeOperation(XbaseInterpreter.java:1060) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1046) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:991) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:901) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:864) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:223) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:826) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:263) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:446) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:227) ~[?:?]

	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:215) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:203) ~[?:?]

	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:189) ~[?:?]

	at org.eclipse.smarthome.model.script.runtime.internal.engine.ScriptImpl.execute(ScriptImpl.java:82) ~[?:?]

	at org.eclipse.smarthome.model.rule.runtime.internal.engine.RuleEngineImpl.lambda$1(RuleEngineImpl.java:310) ~[?:?]

	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]

	at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]

	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]

	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]

	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]

	at java.lang.Thread.run(Thread.java:748) [?:?]

Caused by: java.io.IOException: error=2, Datei oder Verzeichnis nicht gefunden

	at java.lang.UNIXProcess.forkAndExec(Native Method) ~[?:?]

	at java.lang.UNIXProcess.<init>(UNIXProcess.java:247) ~[?:?]

	at java.lang.ProcessImpl.start(ProcessImpl.java:134) ~[?:?]

	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:?]

	... 37 more
0 Likes

(Stephan Fuchs) #91

OK, found the the time to take a tcpdump. I can see that every 5 seconds the following request is made to the VU WebIf:

HTTP: GET /web/powerstate HTTP/1.1

It seems that this is too much for the little VU Zero & the python main thread does not get release after some time. Changed this value to 30 seconds & will check if the box now behaves normal.

EDIT:

When the receiver is online & TV is active there is the following request from the Openhab server, which is done every 5 seconds allthough I’ve changed the refresh intervall to 30 seconds:

GET /web/epgservice?sRef=1:0:19:283D:3FB:1:C00000:0:0:0: HTTP/1.1

EDIT2

The refresh interval value is reset to 5000ms after an restart of Openhab2 service per systemd

EDIT3

Removed binding, all caches & installed 2.3.0 Snapshot. Deleted things & discovered things again. With the VU Ultimo everthing is fine, the refresh interval set through PaperUI is respected. The VU Zero gets polled every 5 seconds regardless what is set as refresh intervall & that is the reason why I’m alway seeing a spinner. I’m quite clueless.

0 Likes

(Kevin) #92

I think you have not create the Script or at wrong Place … Native German Speaker ? PN me …

0 Likes

(Kevin) #93

For those who have problems with updating the items, here is my solution with a rule! :slightly_smiling_face:
(without the Enigma Binding)

Needed Binding / Transformation Service
– http-binding
– RegEx Transformation
Used Items
– enigma_power_switch <-- Switch
– enigma_power_state <-- String
– enigma_channel_state <-- String
– enigma_event_state <-- String
– enigma_eventdescription_state <-- String

var String enigma_ip = "10.10.80.110"

rule "Enigma2 State"
when
    Time cron "0/30 * * ? * * *"
then
  var String powerStateEnigmaLong = executeCommandLine("curl -s http://" + enigma_ip + "/web/powerstate", 5000)
  var String powerStateEnigma = transform("REGEX", ".*?<e2instandby>\n(.*?)\t</e2instandby>.*", powerStateEnigmaLong)
  var String ChannelStateEnigmaLong
  var String ChannelStateEnigma
  var String EventStateEnigma
  var String EventDescriptionStateEnigma

  if (powerStateEnigma == "false") {
    enigma_power_state.postUpdate("Power ON")
    if (enigma_power_switch.state != ON) enigma_power_switch.postUpdate(ON)
    Thread::sleep(1000)
    ChannelStateEnigmaLong = executeCommandLine("curl -s http://" + enigma_ip + "/web/getcurrent", 5000)
    ChannelStateEnigma = transform("REGEX", ".*?<e2servicename>(.*?)</e2servicename>.*", ChannelStateEnigmaLong)
    EventStateEnigma = transform("REGEX", ".*?<e2eventname>(.*?)</e2eventname>.*", ChannelStateEnigmaLong)
    EventDescriptionStateEnigma = transform("REGEX", ".*?<e2eventdescriptionextended>(.*?)</e2eventdescriptionextended>.*", ChannelStateEnigmaLong)
    enigma_channel_state.postUpdate(ChannelStateEnigma)
    enigma_event_state.postUpdate(EventStateEnigma)
    enigma_eventdescription_state.postUpdate(EventDescriptionStateEnigma)
  } else if (powerStateEnigma == "true") {
      enigma_power_state.postUpdate("Standby")
      if (enigma_power_switch.state != OFF) enigma_power_switch.postUpdate(OFF)
      Thread::sleep(1000)
      ChannelStateEnigmaLong = executeCommandLine("curl -s http://" + enigma_ip + "/web/getcurrent", 5000)
      ChannelStateEnigma = transform("REGEX", ".*?<e2servicename>(.*?)</e2servicename>.*", ChannelStateEnigmaLong)
      EventStateEnigma = transform("REGEX", ".*?<e2eventname>(.*?)</e2eventname>.*", ChannelStateEnigmaLong)
      EventDescriptionStateEnigma = transform("REGEX", ".*?<e2eventdescriptionextended>(.*?)</e2eventdescriptionextended>.*", ChannelStateEnigmaLong)
      enigma_channel_state.postUpdate(ChannelStateEnigma)
      enigma_event_state.postUpdate(EventStateEnigma)
      enigma_eventdescription_state.postUpdate(EventDescriptionStateEnigma)
  } else {
      enigma_power_state.postUpdate("Power OFF")
      if (enigma_power_switch.state != OFF) enigma_power_switch.postUpdate(OFF)
      enigma_channel_state.postUpdate("N/A")
      enigma_event_state.postUpdate("N/A")
      enigma_eventdescription_state.postUpdate("N/A")
  }
end

rule "Enigma2 Power Switch"
when
  Item enigma_power_switch received command
then
  var String ChannelStateEnigmaLong
  var String ChannelStateEnigma
  var String EventStateEnigma
  var String EventDescriptionStateEnigma
    if(receivedCommand == ON) {
      executeCommandLine("curl -s http://" + enigma_ip + "/web/powerstate?newstate=4")
      enigma_power_state.postUpdate("Power ON")
      Thread::sleep(1000)
      ChannelStateEnigmaLong = executeCommandLine("curl -s http://" + enigma_ip + "/web/getcurrent", 5000)
      ChannelStateEnigma = transform("REGEX", ".*?<e2servicename>(.*?)</e2servicename>.*", ChannelStateEnigmaLong)
      EventStateEnigma = transform("REGEX", ".*?<e2eventname>(.*?)</e2eventname>.*", ChannelStateEnigmaLong)
      EventDescriptionStateEnigma = transform("REGEX", ".*?<e2eventdescriptionextended>(.*?)</e2eventdescriptionextended>.*", ChannelStateEnigmaLong)
      enigma_channel_state.postUpdate(ChannelStateEnigma)
      enigma_event_state.postUpdate(EventStateEnigma)
      enigma_eventdescription_state.postUpdate(EventDescriptionStateEnigma)
    } else if(receivedCommand == OFF) {
      executeCommandLine("curl -s http://" + enigma_ip + "/web/powerstate?newstate=5")
      enigma_power_state.postUpdate("Standby")
      Thread::sleep(1000)
      ChannelStateEnigmaLong = executeCommandLine("curl -s http://" + enigma_ip + "/web/getcurrent", 5000)
      ChannelStateEnigma = transform("REGEX", ".*?<e2servicename>(.*?)</e2servicename>.*", ChannelStateEnigmaLong)
      EventStateEnigma = transform("REGEX", ".*?<e2eventname>(.*?)</e2eventname>.*", ChannelStateEnigmaLong)
      EventDescriptionStateEnigma = transform("REGEX", ".*?<e2eventdescriptionextended>(.*?)</e2eventdescriptionextended>.*", ChannelStateEnigmaLong)
      enigma_channel_state.postUpdate(ChannelStateEnigma)
      enigma_event_state.postUpdate(EventStateEnigma)
      enigma_eventdescription_state.postUpdate(EventDescriptionStateEnigma)
    }
end

Play with the Time cron to find the best Solution for your SetUp … the Time cron in this Example corresponds to a refresh interval of 30 seconds

Every 15 seconds

Time cron "0/15 * * ? * * *"

Every 30 seconds

Time cron "0/30 * * ? * * *"

Every 45 seconds

Time cron "0/45 * * ? * * *"

Every 60 seconds

Time cron "0 * * ? * * *"
0 Likes

Enigma2 sitemap
(Jens) #94

Hi Kevin,

could you please show how you have defined
– enigma_power_switch <-- Switch
– enigma_power_state <-- String
– enigma_channel_state <-- String
– enigma_event_state <-- String
– enigma_eventdescription_state <-- String

Would be great. Thanks.

0 Likes

(Kevin) #95
Switch enigma_power_switch "VUplus WZ Power"
String enigma_power_state "VUplus WZ Power State"
String enigma_channel_state "VUplus WZ Channel"
String enigma_event_state "VUplus WZ Event"
String enigma_eventdescription_state "VUplus WZ Event Description"
0 Likes

(Jens) #96

Hi Kevin,
Thank you. I copied the items to my .items file and the rules to my .rules file, and changed the IP-address of my Solo.4K accordingly. By the way: where I have to put in the “var” declaration? But it does not work at all. Can you help me getting it to work? How do you use it in you setup?

Remark: in openhab.log rhe following message occurs regarding the “var” declaration:

2018-02-11 11:10:22.421 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘meine.rules’ has errors, therefore ignoring it: [314,1]: missing EOF at ‘var’

What am I doing wrong here?

0 Likes

(Kevin) #97

Put this Line on the Top of your Rules file … than it work :slight_smile:

var String enigma_ip = "10.10.80.110"
0 Likes

(Jens) #98

Hm…, now I get these messages:

2018-02-11 17:41:32.318 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “curl” (in directory “.”): CreateProcess error=2, Das System kann die angegebene Datei nicht finden)
2018-02-11 17:42:00.089 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “curl” (in directory “.”): CreateProcess error=2, Das System kann die angegebene Datei nicht finden)
2018-02-11 17:42:30.076 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “curl” (in directory “.”): CreateProcess error=2, Das System kann die angegebene Datei nicht finden)

0 Likes

(Kevin) #99
sudo apt-get install curl
0 Likes

(Jens) #100

I’m on Windows. Do you have an idea how to install it on Windows?

0 Likes

(Kevin) #101

No … Windows sucks :wink:

0 Likes

(Sven Grünbacher) #102

Hello,
thanks for the binding, it helps me very for the first steps, I’m a very newby in openhab2.

I try to program a button with examble the “exit” key from enigma, but i don’t get it run.
Can you simple show me the way to create new button functions?

Thank you very much

0 Likes

(Christian) #103

Hi,

I’m new to openhab, but i successfully added my Fritzbox, CometDect an Samsung TV.

Now i’m trying to add my AX51-Enigma2 receiver.
I installed the precompiled binding from this topic.

I can change volume and turn it on/off. but i can’t send keys (channel number, ok, menu, …)

i created an butten in habpannel --> send fixed value to item (to Ax51_RemoteKey), and added a number as value - without success.
has someone an idea what’s going wrong?

LOG–> https://pastebin.com/4VJnEBpX

thanks!

0 Likes

(Matthias Dohr) #104

hello all,

i´ve also the problem that the addon does not start.
i am on openHAB 2.3.0~20180120102227-1 (Build #1191)

[10:52:55] openhabian@openHABianPi:/usr/share/openhab2/addons$ ls -la
total 104
drwxrwxr-x+ 2 openhab openhabian  4096 Feb 22 08:17 .
drwxr-xr-x  4 openhab openhab     4096 Jan 20 16:40 ..
-rw-rw-r--  1 openhab openhab    59304 Jan 27 14:24 org.openhab.binding.denonmarantz-2.3.0-SNAPSHOT.jar
-rw-rw-r--  1 openhab openhab    32172 Feb 22 08:17 org.openhab.binding.enigma2_2.3.0.SNAPSHOT.jar
-rw-rw-r--  1 openhab openhab       70 Jan 20 10:22 README
[10:53:00] openhabian@openHABianPi:/usr/share/openhab2/addons$

for me it looks like the denon binding and the enigma binding have the same rigths, the denon binding runs, enigma not.
i am not so firm in linux and dont know if the enigma needs other rigths

thank you for help

0 Likes

(Matthias Dohr) #105

I solved it by myself, I found a guide in another thread.

systemctl stop openhab2 cd /usr/share/openhab2/addons 

wget "https://github.com/tratho/org.openhab.binding.enigma2-dist/raw/master/org.openhab.binding.enigma2_2.1.0.SNAPSHOT.jar" 
chown openhab:openhab org.openhab.binding.enigma2_2.1.0.SNAPSHOT.jar
 systemctl start openhab2 

And just change 2.1.0 to 2.3.0 .
So it works for me.

Hope it helps other people

0 Likes

(Nicke) #106

I have the same thing.
I can see channel name, set mute, power etc.
But not send remote key (for instance change channel).

0 Likes

(JohnD) #107

Have you found any workaround?

0 Likes