UDP Listener Plugin

Posted on
Mon Oct 15, 2018 8:39 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

That is strange. I wonder if the port is getting closed by the OS for some reason.

Can you create an issue on this here: https://github.com/FlyingDiver/Indigo-U ... ner/issues

Thanks!

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Oct 15, 2018 11:33 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: UDP Listener Plugin

No worries, will do!
[will repeat in the GitHub post but I've been watching the logs closely today, and seen the problem recur after the Indigo hosting Mac appeared to go into sleep mode. Unlike my other Indigo site which uses a mini, at this location I run Indigo on a MacBook Air with which I have recurring issues in preventing sleep - seemingly intractable inspire of using various apps (currently Amphetamine) and the 'caffeinate' native command and other approaches it occasionally recurs.) I wonder if the plugin is failing to reconnect successfully after that occurs.]

Posted on
Tue Oct 16, 2018 8:15 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: UDP Listener Plugin

Different Computers wrote:
For those of us who may not realize how much we need this, could you describe a use case?
(Thank you for going where I was embarrassed to go)


Sent from my iPhone using Tapatalk

Posted on
Tue Oct 16, 2018 8:46 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

mundmc wrote:
Different Computers wrote:
For those of us who may not realize how much we need this, could you describe a use case?
(Thank you for going where I was embarrassed to go)


There's a couple discussed in this thread. One user is using it to monitor UDP broadcasts from a Global Cache device monitoring his property gate. Another is using it to monitor an HVAC unit that sends status updates via UDP.

Another would be just to listen on the UPnP port and send an alert anytime a device tries to auto-configure. Good for monitoring IoT type devices.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Oct 16, 2018 8:48 am
mundmc offline
User avatar
Posts: 1060
Joined: Sep 14, 2012

Re: UDP Listener Plugin

I read through them already! I appreciate your work, I was just self-conscious I had no idea (initially) how UDP worked. I learned today!


Sent from my iPhone using Tapatalk

Posted on
Sat Oct 27, 2018 5:05 am
Albatros offline
Posts: 132
Joined: Feb 07, 2015

Re: UDP Listener Plugin

Thank you very much for this plugin. I am now able to monitor if my Daikin Airco has been switch on/off-temperature etc. change made by the remote control and update this info to the Daikin device in Indigo.

Posted on
Wed May 11, 2022 6:52 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin updated for Indigo 2022.1


joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 14, 2022 5:19 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: UDP Listener Plugin

Hi,

A new (to me) error is being reported by the UDP Listener, triggered by a UDP broadcast from my Rako lighting automation system.

Code: Select all
14 Nov 2022 at 10:40:42
   UDP Listener Error              Error in plugin execution runConcurrentThread:

  File "plugin.py", line 94, in runConcurrentThread
  File "plugin.py", line 94, in <genexpr>
type: ord() expected string of length 1, but int found

   UDP Listener Error              plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   UDP Listener Error              Error in plugin execution runConcurrentThread:

  File "plugin.py", line 94, in runConcurrentThread
  File "plugin.py", line 94, in <genexpr>
type: ord() expected string of length 1, but int found

   UDP Listener Error              plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Trigger                         Rako Change
   UDP Listener Error              Error in plugin execution runConcurrentThread:

  File "plugin.py", line 94, in runConcurrentThread
  File "plugin.py", line 94, in <genexpr>
type: ord() expected string of length 1, but int found

   UDP Listener Error              plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
   Script                          S


Not sure what changed - it used to work fine! My own python monitor is still reading and decoding Rako messages as before.

Posted on
Mon Nov 14, 2022 5:28 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

Do you know what the content of the message is that's causing the error? It's failing while trying to convert the non-string (binary) data to a printable string to put in the device state.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 14, 2022 11:06 am
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: UDP Listener Plugin

Here's the output of my own script, followed by the UDP listener debug info and the Indigo script that runs to decode it.

The error doesn't always occur. Here's one without it.

My script listens for UDP messages and decodes them. The format is: timestamp (message received in hex) Decoded message in English

Code: Select all
2022-11-14 16:09:54 ( 53 07 00 51 00 31 00 01 7d ) Family Room All Channels Set Scene 1


Indigo event log:
Code: Select all
14 Nov 2022 at 16:09:54
   UDP Listener Debug              BETA RakoListener: UDP msg from: ('192.168.1.24', 2861), data: S
   UDP Listener Debug              Checking Trigger Rako Change (29599077), Type: messageReceived
   Trigger                         Rako Change
   Script                          S


And here's one with the error:

First my script:
Code: Select all
2022-11-14 16:20:00 ( 53 0a 00 41 00 31 01 01 00 00 00 8c ) Outside All Channels Set Scene 1


And now the Indigo log:
Code: Select all
14 Nov 2022 at 16:20:00
   UDP Listener Error              Error in plugin execution runConcurrentThread:

  File "plugin.py", line 94, in runConcurrentThread
  File "plugin.py", line 94, in <genexpr>
type: ord() expected string of length 1, but int found

   UDP Listener Error              plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)


Second example:

Code: Select all
2022-11-14 16:48:19 ( 53 07 00 39 00 31 01 00 95 ) Lounge All Channels Set Scene 0


Code: Select all
14 Nov 2022 at 16:48:13
   Trigger                         Rachel's Phone Online
   UDP Listener Error              Error in plugin execution runConcurrentThread:

  File "plugin.py", line 94, in runConcurrentThread
  File "plugin.py", line 94, in <genexpr>
type: ord() expected string of length 1, but int found

   UDP Listener Error              plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)

Posted on
Mon Nov 14, 2022 11:38 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

Is there more to the data than what you're showing? Those byte sequences aren't long enough for the text that follows. In the second test, the "8c" is non-ascii, and the "95" in the last one. So that's where the error is coming from. It's my code that's not handing non-ascii properly. I'll need to re-write the section that decodes the string that gets put in the device state. I don't think I ever fixed that section properly for Python3.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 14, 2022 12:07 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

Fixed in 2202.0.1, should be in plugin store now.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Mon Nov 14, 2022 1:23 pm
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: UDP Listener Plugin

Yes, there's more information in those messages than I bother to decode. It's a proprietary Rako format; details here if you're interested: https://rakocontrols.com/media/1956/accessing-the-rako-bridge-v222.pdf

Will try the update now.

Posted on
Mon Nov 14, 2022 1:27 pm
MartinG offline
Posts: 116
Joined: Aug 19, 2016

Re: UDP Listener Plugin

Yes, there's more information in those messages than I bother to decode. It's a proprietary Rako format; details here if you're interested: https://rakocontrols.com/media/1956/accessing-the-rako-bridge-v222.pdf

Update seems to be working :-) Thanks! There's still a minor error, though it's not affecting what I want to do.

My script:
Code: Select all
2022-11-14 19:24:22 ( 53 07 00 39 00 31 01 00 95 ) Lounge All Channels Set Scene 0


Indigo Log:
Code: Select all
14 Nov 2022 at 19:24:22
   UDP Listener Debug              BETA RakoListener: Error decoding string message: 'utf-8' codec can't decode byte 0x95 in position 8: invalid start byte
   UDP Listener Debug              BETA RakoListener: UDP msg from: ('192.168.1.24', 2861), data: 53:07:00:39:00:31:01:00:95
   UDP Listener Debug              Checking Trigger Rako Change (29599077), Type: messageReceived
   Trigger                         Rako Change
   Script                          53:07:00:39:00:31:01:00:95
   Script                          Lounge All Channels Set Scene
   Script                          Set scene 0


Messages all seem to match up.

Posted on
Mon Nov 14, 2022 1:47 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: UDP Listener Plugin

That's not really an error. It tries to convert the payload to a unicode string first. If that fails, it just formats the bytestring.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 2 guests