Page 3 of 4

Re: UDP Listener Plugin

PostPosted: Mon Oct 15, 2018 8:39 pm
by FlyingDiver
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!

Re: UDP Listener Plugin

PostPosted: Mon Oct 15, 2018 11:33 pm
by agame
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.]

Re: UDP Listener Plugin

PostPosted: Tue Oct 16, 2018 8:15 am
by mundmc
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

Re: UDP Listener Plugin

PostPosted: Tue Oct 16, 2018 8:46 am
by FlyingDiver
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.

Re: UDP Listener Plugin

PostPosted: Tue Oct 16, 2018 8:48 am
by mundmc
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

Re: UDP Listener Plugin

PostPosted: Sat Oct 27, 2018 5:05 am
by Albatros
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.

Re: UDP Listener Plugin updated for Indigo 2022.1

PostPosted: Wed May 11, 2022 6:52 am
by FlyingDiver

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 5:19 am
by MartinG
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.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 5:28 am
by FlyingDiver
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.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 11:06 am
by MartinG
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)

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 11:38 am
by FlyingDiver
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.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 12:07 pm
by FlyingDiver
Fixed in 2202.0.1, should be in plugin store now.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 1:23 pm
by MartinG
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.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 1:27 pm
by MartinG
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.

Re: UDP Listener Plugin

PostPosted: Mon Nov 14, 2022 1:47 pm
by FlyingDiver
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.