Need help porting LANnouncer DTH

???
Why would we follow that?

Rather than dismissing my comment with a snide remark, the reason why it does not work or how to work around this issue would be much more helpful.

Just in case you did not read the Lannouncer documentation: it allows for imbedded commands in its speak command stream.

Can you say why it does not work? I don't follow at all. The command is a http post or get that is sent to the app, is the message not being sent? Is the format incorrect? You say that HE is not properly handling the message, please let me know how it is not.

per your request

Ok, so if I'm reading that right,, Lannouncer is expecting a non url encoded character in a url? As far as I know pipe is not a valid character in a url.

url encoding of:
+@TTSSMS@+&&SPEAK=@|ALARM=CHIME&@DONE@**

becomes:
%2B%40TTSSMS%40%2B%26%26SPEAK%3D%40%7CALARM%3DCHIME%26%40DONE%40%2A%2A

Does Lannouncer do url decoding or not? I'm not terribly surprised that it doesn't "detect" url encoding from two buried chars.

Lannouncer is an Android app with a ST DTH that's was ported to HE. I'm a Lannouncer user, not the developer. I don't know how or why, but it works in ST. I do a lot of work on my website with sending and receiving data in a message, so I am very familiar with Url encode and decode.

@arnb
You have given me an idea for a new feature in MC that might eventually make it to the app.
Rather than add code which only helps a couple of users of lannouncer I’m considering a ‘prefix mp3’
Which would be configurable for an mp3 hosted locally.
This way if you have a ‘chime’ mp3 then anyone can use it as a prefix (or any other mp3)
This in only really an extension of the mp3 playing facility that already exists in Message Central so shouldn’t be too difficult to code in.

Andy

I'm sure that would be used by many people, however while Lannouncer can also play an MP3, the chime, doorbell and siren sounds are by a command.

BTW on ST many people, me included, use Kindle Fires for both ActionTiles and Lannouncer. With ST's unknown future direction and general lack of stability, These users may give HE a substantial uptick in ST migrations.

So this whole thing was interesting to me, what I found is that LANnouncer is not following standards and that is why you are seeing this problem. Hubitat is expecting valid requests and responses when you are using the HubAction in the normal way. It turns out that we were properly handling the request, its just that the request was bad. However you can send raw messages using HubAction. I'd recommend you change this code:

        def hubAction = new hubitat.device.HubAction(
            method: method,
            path: "/"+commandString,
            headers: headers
            );

to this instead:

		def hubAction = new hubitat.device.HubAction(
			"GET /${commandString} HTTP/1.1\r\nHOST: $DeviceLocalLan:$DevicePort\r\nAccept: */*\r\nUser-Agent: Linux UPnP/1.0 Hubitat\r\n\r\n", 
			hubitat.device.Protocol.RAW_LAN
			)

and test with that.

2 Likes

Apprecite your inquisitive nature, you taking the time to actually figure this out, and for creating a workaround. Thank you!

I'll give it a try when I get some free time in a few days, and I'm sure @Cobra can put this to good use.

Can you please provide a link to the Hubitat Groovy documentation.

Documentation is a work in progress

https://docs.hubitat.com

I replaced the code you provided. I also have some errors, but can't determine the cause. The text is being sent and received on the Lannouncer Apps installed on the phones and seem to work well, but still throwing errors. I was wondering if anyone had thoughts about the errors.

dev:1612018-12-11 10:26:52.421 pm infoFront Door was closed

app:2462018-12-11 10:26:51.262 pm infoDoor Announce is now True

dev:1652018-12-11 10:26:51.245 pm warnThe server failed to respond with a valid HTTP response

dev:1652018-12-11 10:26:50.861 pm debugGET /&SPEAK=Front%20Door%20open&@DONE@ HTTP/1.1 Accept: / User-Agent: Linux UPnP/1.0 Hubitat HOST: 192.168.1.98:1035

dev:1652018-12-11 10:26:50.851 pm debug040B

dev:1652018-12-11 10:26:50.850 pm debugIP address entered is 192.168.1.98 and the converted hex code is C0A80162

dev:1652018-12-11 10:26:50.849 pm infoSending command &SPEAK=Front%20Door%20open&@DONE@ to 192.168.1.98:1035

dev:1652018-12-11 10:26:50.846 pm infoCommand request: &SPEAK=Front%20Door%20open&@DONE@

dev:1652018-12-11 10:26:50.846 pm debugExecuting 'speak'

dev:1642018-12-11 10:26:50.835 pm warnThe server failed to respond with a valid HTTP response

dev:1642018-12-11 10:26:50.729 pm debugGET /&SPEAK=Front%20Door%20open&@DONE@ HTTP/1.1 Accept: / User-Agent: Linux UPnP/1.0 Hubitat HOST: 192.168.1.99:1035

dev:1642018-12-11 10:26:50.697 pm debug040B

dev:1642018-12-11 10:26:50.696 pm debugIP address entered is 192.168.1.99 and the converted hex code is C0A80163

dev:1642018-12-11 10:26:50.693 pm infoSending command &SPEAK=Front%20Door%20open&@DONE@ to 192.168.1.99:1035

dev:1642018-12-11 10:26:50.690 pm infoCommand request: &SPEAK=Front%20Door%20open&@DONE@

dev:1642018-12-11 10:26:50.687 pm debugExecuting 'speak'

app:2462018-12-11 10:26:50.581 pm infoDoor Announce: Front Door contact open

dev:1612018-12-11 10:26:50.470 pm infoFront Door was opened

I have another error being thrown, but I think it belongs to BigTalker. That one looks like this:

dev:1612018-12-11 10:22:33.059 pm infoFront Door is inactive

dev:1612018-12-11 10:22:23.084 pm errorgroovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.math.BigInteger#. Cannot resolve which method to invoke for [null, class java.lang.Integer] due to overlapping prototypes between: [class [I, int] [class [B, int] [class java.lang.String, int] (parse)

Oh, this is cool! I'm the LANNouncer author, just gave up on SmartThings, and was wondering how much work it would be to get LANNouncer working with Hubitat. It's great to see that it's not all that hard and it's already been done!

I've had my Hubitat for less than a day, so I've got a lot of learning to do.

6 Likes

Welcome to the Hubitat world @NWTony . I started with a SmartThings v1 hub a friend upgraded from, purchased a v2, then came to Hubitat. Some of the things I missed with ST have been growing and expanding quickly here.
I don't program nor do I speak groovy, so LANnouncer is still throwing some errors, but they don't seem to affect the operation.
I should find a better/more reliable speaker system than two old phones (in two different rooms) that make the announcements.
Again, welcome aboard.

I believe @jpark wrote this version for HE. I believe the idea of LANnouncer was to annonce on the LAN. But somehow, if the HE is off the Internet, it does not work.

Can you clarify if I'm right? And what would be required to make it work without the Internet on HE?

Thanks

@NWTony:
Hello. Have you got LANnouncer ported over to Hubitat?

The port mentioned above is working great. That's the beauty of an open-source system; I wrote the original, for SmartThings, and when I moved to Hubitat quite some time ago someone else had already ported my code over. :+1:

4 Likes

Hey @NWTony, is Lannouncer still alive? I noticed the keybounce site was down.

The app still works and the servers are still live; I moved them but they're there.
I was running the site on a VPS, which was rather pricey, and not nearly covered by the donations, so it didn't seem worth keeping up.