Hauptmenü

LIRC send?

Begonnen von andyclimb, 21 November 2014, 13:55:46

Vorheriges Thema - Nächstes Thema

andyclimb

Hi all,

I have LIRC on my rPI receiving AND sending signals...

but the LIRC implementation in them only seems to do receive. 

Can I configure fhem to send out via LIRC...

Even better if this would work with fhemtofhem as my LIRC is on a different Pi...

A


AM

ChrisD

Hello,

I'm using a modified version of the LIRC-module that can connect to the LIRC daemon over the network. The advantage is that FHEM doesn't need to be installed on the machine with the LIRC daemon. Furthermore the module supports sending commands to LIRC using the same syntax than the irsend command line utility. The disadvantage is that the LIRC daemon must run in listen mode which doesn't have any security checks.

ChrisD

andyclimb

I would be very interested in that set up. Security is not a problem as it is a home network!

Could you give me some more specific instructions.

I'm in the process of designing a unique gadget and your help would be appreciated:)

Many thanks

A


Sent from my iPhone using Tapatalk
AM

ChrisD

#3
Attached you find my module. It must be copied to the FHEM folder and activated with 'reload 00_cLirc'. To use the module your lirc daemon must be running with the --listen parameter. I modified the startup script /etc/init.d/lirc on the rPi to include it. If you can telnet to port 8765 on the rPi the lirc daemon is configured correctly and you can define the connection from FHEM with
define lirc_rPi cLirc IP_of_rPi
If the connection succeeds the 'state' will change to 'opened' and the 'received' reading will contain the pressed keys.

I am using a notify that calls a function in 99_myutils to handle the incoming keypresses:
define n_lirc_rPi notify lirc_rPi:received.* {h_LircRpi($EVENT)}

The function looks like this:
sub h_LircRpi($)
{
  my ($evt)=@_;

  if ($evt eq "KEY_RED") {fhem "set LW12_K RGB FF0000";}
  if ($evt eq "KEY_GREEN") {fhem "set LW12_K RGB 00FF00";}
  if ($evt eq "KEY_3") {fhem "set SB_Rpi_K volumeUp";}
  if ($evt eq "KEY_4") {fhem "set SB_Rpi_K volumeDown";}
}


Codes can be sent with
set lirc_rPi SEND_ONCE REMOTE CODE

The module does not show the result of the 'set' commands, the result is however logged to the fhem-logfile if the loglevel is at least 3.

ChrisD

andyclimb

Thank you. I will let you know how I get on!


Sent from my iPhone using Tapatalk
AM

mtk

Hi
I installed cLirc and I can see the events within my event monitor:

Events (Filter: .*)   FHEM log   

2017-02-28 09:01:48.782 CUL_WS CUL_WS_3 T: 4.3  H: 72.5
2017-02-28 09:01:48.782 CUL_WS CUL_WS_3 temperature: 4.3
2017-02-28 09:01:48.782 CUL_WS CUL_WS_3 humidity: 72.5
2017-02-28 09:01:54.960 cLIRC lirc_rPiNode2 received: KEY_3
2017-02-28 09:01:54.961 cLIRC lirc_rPiNode2 KEY_3
2017-02-28 09:01:59.151 dummy Heartbeat off
2017-02-28 09:02:02.599 cLIRC lirc_rPiNode2 received: KEY_4
2017-02-28 09:02:02.600 cLIRC lirc_rPiNode2 KEY_4
2017-02-28 09:02:04.148 dummy Heartbeat on
2017-02-28 09:02:04.150 at t_Heartbeat Next: 09:02:14


What is not working, is the part within 99_myUtils:
# event handler cLirc lirc_PiNode2
sub h_LircPiNode2($)
{
  my ($evt)=@_;

  if ($evt eq "KEY_CHANNELDOWN") {fhem "set IT_B_3 off" ; }
  if ($evt eq "KEY_CHANNELUP") {fhem( "set IT_B_3 on" ); } 
  if ($evt eq "KEY_3") {fhem "set IT_B_3 on" ;}
  if ($evt eq "KEY_4") {fhem "set IT_B_3 off" ;}
}


Because I want to use many Lirc Pi nodes in parallel, I just renamed some parts to realize that in FHEM:
As you can see I am not really familiar with that syntax in terms of brackets, spaces a.s.o.
so I made some tests with different notations, but there was no reaction on device IT_B_3.

define lirc_rPiNode2 cLIRC pinode2.daheim

# original was define n_lirc_rPi notify lirc_rPi:received.* {h_LircRpi($EVENT)}
define n_lirc_rPiNode2 notify lirc_rPiNode2:received.* {h_LircPiNode2($EVENT)}


So what is wrong within my configuration?
Cant find any mistakes any more ...

kind regards
Michael

aktuelles FHEM auf XEN Server, Debian VM,  usb-redirector (XEN host -> VM):  (868 MHz) CUL V3 + (868 MHz) CUL V3

Nodes: RPi with shairport-sync, cLirc, mjpg-streamer, mpd, hostapd, hifiberry, TTS (picowave), NOOBS Multiboot (raspian + openelec)

mtk

#6
solved my problem here: https://forum.fhem.de/index.php?topic=68136.msg596004#msg596004

So notify should use EVTPART1 instead:

define define n_lirc_rPi notify lirc_rPi:received.* {h_LircRpi($EVTPART1)}
aktuelles FHEM auf XEN Server, Debian VM,  usb-redirector (XEN host -> VM):  (868 MHz) CUL V3 + (868 MHz) CUL V3

Nodes: RPi with shairport-sync, cLirc, mjpg-streamer, mpd, hostapd, hifiberry, TTS (picowave), NOOBS Multiboot (raspian + openelec)