Autor Thema: LIRC send?  (Gelesen 1077 mal)

Offline andyclimb

  • Full Member
  • ***
  • Beiträge: 140
LIRC send?
« am: 21 November 2014, 13:55:46 »
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

Offline ChrisD

  • Sr. Member
  • ****
  • Beiträge: 685
Antw:LIRC send?
« Antwort #1 am: 23 November 2014, 10:07:50 »
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

Offline andyclimb

  • Full Member
  • ***
  • Beiträge: 140
Antw:LIRC send?
« Antwort #2 am: 01 Dezember 2014, 20:48:11 »
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

Offline ChrisD

  • Sr. Member
  • ****
  • Beiträge: 685
Antw:LIRC send?
« Antwort #3 am: 01 Dezember 2014, 22:28:33 »
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_rPiIf 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
« Letzte Änderung: 02 Dezember 2014, 07:43:53 von ChrisD »

Offline andyclimb

  • Full Member
  • ***
  • Beiträge: 140
Antw:LIRC send?
« Antwort #4 am: 02 Dezember 2014, 03:22:11 »
Thank you. I will let you know how I get on!


Sent from my iPhone using Tapatalk
AM

Offline mtk

  • New Member
  • *
  • Beiträge: 14
    • LinkedIn
Antw:LIRC send?
« Antwort #5 am: 28 Februar 2017, 09:24:29 »
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)

Offline mtk

  • New Member
  • *
  • Beiträge: 14
    • LinkedIn
Antw:LIRC send?
« Antwort #6 am: 28 Februar 2017, 13:31:21 »
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)}
« Letzte Änderung: 01 März 2017, 09:43:09 von mtk »
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)