Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Send Commands to FHEM

If you have a question or need help, this is the place to be.
Post Reply
spynet
Posts: 5
Joined: Tue Jan 01, 2013 7:58 pm

Send Commands to FHEM

Post by spynet »

Hello,
i would like to send commands from EventGhost (HTPC Win8x64) to FHEM (Ubuntu).
So I can turn on an off the lights (that ar originally controlled via FHEM), using my HTPC-IR-Controller.

FHEM is reachable via telnet port 7072 and via http port 8083.
In the webbrowser i only have to send on or off command in the address bar.
The following links are switching the lamp directly from the call in the address bar on or off.
"http://192.168.167.132:8083/fhem?cmd.my ... itch3%20[b]on[/b]&room=Wohnzimmer"
"http://192.168.167.132:8083/fhem?cmd.my ... itch3%20[b]off[/b]&room=Wohnzimmer"
But how can I do this using EventGhost. Is the webserver plugin able to do this?
This should run complete in background without opening an window, so that wathing tv will not be influenced.

Another way I┬┤ve tried, is using an VB Script. The script itself is working. But there is an unwanted delay because of the sleep timer.
Further I can not start the script via EventGhost. I┬┤ve tried to start it with an batch file but the VBScript then is not working.
I think it has something to do with the user-rights, because telnet can not be found.
If I start the batch manually via dubble click or as admin, it┬┤s working.

<job>
<script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 100
WshShell.SendKeys "telnet 192.168.167.132 7072"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "set myITSwitch3 on"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "quit"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys ("{Enter}")
WshShell.SendKeys "exit"
WshShell.SendKeys ("{Enter}")
WScript.Quit
</script>
</job>

I am looking for a way to control FHEM without much delay.
Has anyone an idea for me or already experiences in this direction?

thanks for respone
regards
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Send Commands to FHEM

Post by Sem;colon »

spynet wrote:But how can I do this using EventGhost. Is the webserver plugin able to do this?
Yes!
It has an action: "send event to another webserver" which does exactly what you want.
If you like my work, Image me a drink :wink:
spynet
Posts: 5
Joined: Tue Jan 01, 2013 7:58 pm

Re: Send Commands to FHEM

Post by spynet »

I┬┤ve tried to use this action already.
I┬┤ve first installed the Plugin.
If I click -> Add Action... -> Webserver -> Send event to another webserver
There appears lots of errors in the log, but there are no parameters to set up.
Do you know, how to use this Action?
Attachments
screenshot.JPG
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Send Commands to FHEM

Post by Sem;colon »

well, I should know it, after all I wrote it... 8)
What do you mean by "there are no parameters to set up"?

What did you enter here:
Unbenannt.png
Unbenannt.png (6.69 KiB) Viewed 3689 times
If you like my work, Image me a drink :wink:
spynet
Posts: 5
Joined: Tue Jan 01, 2013 7:58 pm

Re: Send Commands to FHEM

Post by spynet »

I've not seen that windows before.
When I klick "send event to another Webserver" to add an action, only the errors in the log appears.
I will try it tomorrow with another installation when i'm back from business trip.
Sem;colon
Plugin Developer
Posts: 625
Joined: Sat Feb 18, 2012 10:51 am
Location: Germany

Re: Send Commands to FHEM

Post by Sem;colon »

If you are not using the latest Version (2.0) You can also try to use that version which you can find here viewtopic.php?f=9&t=1663&start=45 - it shouldn't make a difference, but you never know ;-)
Last edited by Sem;colon on Fri Jan 24, 2014 9:03 pm, edited 1 time in total.
If you like my work, Image me a drink :wink:
spynet
Posts: 5
Joined: Tue Jan 01, 2013 7:58 pm

Re: Send Commands to FHEM

Post by spynet »

I┬┤ve used the version included in EventGhost_0.4.1.r1640_Setup.exe
With Version 2 of WebServer plugin, everything works fine. That saves a lot of work for me.
Thank you
Post Reply