Android Notification Binding configuration

Hi All

I am currently diplaying notifications on android TV using PipUP. However due to no support for rtsp, i am considering using TVoverlay wihc works with Android Notifications Binding. I installed this android notification binding and cannot seem to be able to make it work. The android TV Overlay app is installed. The tv was automatically discovered. The TV overlay thing is online but there are no channels are available.

I have used the example provided in my rule to test, the example is below
getActions("androidnotifications", "androidnotifications:tvoverlaydisplay:SonyTV").sendVideo("123", "Backyard", "Movement Detected","rtsp://admin:password@192.168.4.6:554/Streaming/Channels/102?transportmode=unicast&profile=Profile_1")

I have replaced the “ThTV” with my percieved entry as shown below

getActions("androidnotifications", "androidnotifications:tvoverlaydisplay:SHIELDAndroidTV66216372").sendVideo("123", "Gate", "Movement Detected","rtsp://admin:password@192.168.0.100:/ch0_0264")

Below is the error i get when i invoke the rule

java.lang.reflect.UndeclaredThrowableException: null
        at jdk.proxy1182.$Proxy1496.apply(Unknown Source) ~[?:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$12(SchedulerImpl.java:189) ~[?:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$1(SchedulerImpl.java:88) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:840) [?:?]
Caused by: org.openhab.core.model.script.engine.ScriptExecutionException: The name 'ScriptResponse' cannot be resolved to an item or type; line 212, column 33, length 14
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:1008) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:971) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:247) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluateArgumentExpressions(XbaseInterpreter.java:1222) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._invokeFeature(XbaseInterpreter.java:1152) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.invokeFeature(XbaseInterpreter.java:1098) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:151) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:1008) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:971) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:247) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:475) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:251) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:488) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:267) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:475) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:251) ~[?:?]
        at org.openhab.core.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:227) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:213) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:47) ~[?:?]
        at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:30) ~[?:?]
        ... 9 more

I do not see an Android Notifications binding among the officially supported add-ons. The Marketplace add-on appears to be compiled for OH 4.2. You do not mention which version of OH you are running.

Thank you im running OH 4.1

It turns out that the autodiscovered item was problematic. It simply does not work when autodiscovered. After manually creating the thing. Everything works as expected with exception of the feature which i was hoping to use. Video does not work. General notifications and Image notification works.

I believe the video will conflict if you are playing due to audio. Make sure you are not playing or paused when you test this as it does work here. I have not done any tests to see if it works when the audio stream is missing from the rtsp feed. It also is meant to support HLS and the ipcamera binding can strip the audio out and create a HLS feed. This requires changing settings as per the ipcamera docs. I have not tested it other then the feature does work when nothing is playing and this is mentioned in the github for the TvOverlay app. I do not know if this is some thing they will improve on in future versions. There is another way to get a moving stream and that is to send the same message ID with the same static picture over and over as it is meant to just update the picture and not redraw the message box when you do this.

thank you. i will test that. In my previous tests, I noted that if androidtv is playing anything and notifiication with video and audio is received, it pauses the currently playing item. I will test with HLS.

Interested to know what you find when you test. I have implemented the Api which only sends a command to tell the app on your TV to do something. So what happens and how their code runs on your TV is best talked about with the TvOverlay deva, which I linked to their github in the first post of the main thread on this binding. You can read the open and closed issues on their github which is my source on a possible reason why it can not do Rtsp with audio when Netflix is streaming on the TV for example.

On my setup I use snapshots not a stream for this reason and use the download: prefix so the image is captured as close to the point in time as the person crosses a trip wire or PIR detects the person. This works best for me as it works when streaming is happening. I was finding that when you open a stream when someone is running through the field of view of your camera, by the time the stream opens and is displayed your left looking at a video feed that shows no one as they have run out of view. I find the snapshots work best in this way for my situation this is why I have not bothered to look for reasons and work arounds.

I was looking/considering adding a mjpeg feature that would auto send multiple images using the image Api but giving the result of a moving picture without needing to implement it yourself in rules. If you like this idea, I just need it tested to prove the concept and then I can implement it in an easier way in the binding.

I hope that makes sense.

Thanks it makes sense. I do use snapshots and they work great. However in my case, My camera is overlooking my main gate. I want to trigger video display when persons motion has been is detected continuously for more than a a few seconds to a few minutes. typically happens when someone is trying to ring the bell at the gate or thieves moving outside my property. I was previously using a plugin on Kodi, it worked exactly the way you stated. It played the snapshots in quick succession for 15 -20secs. It was good enough for me to stay away from video.

tested the HLS feed and definitely works but with the drawback of taking time to start. I am happy to test the idea of multiple snapshots. let me know once you are ready.

Great thanks for testing and confirming it works, did you need to do anything to make it work, or did defaults all work right away? I will update the readme to cover the audio make cause issues and mention HLS is one way to allow it to stream whilst you are watching other video sources on the TV. so any info to help others would be great.

As for it taking time to start, you can tell the ipcamera binding to create the HLS non stop to greatly speed it up, but due to the fundamental way HLS works you will be at least a few seconds behind realtime (around 4 seconds with defaults if you do not lower this). This can actually be a feature as you then get to “see into the past” at what triggered the alarm state.

You are able to do your own testing by using a rule. To trick the TV into not using the cached snapshot, you will need to send the image using the download: feature of the binding.

Thanks it worked right out the box with defaults. I didnt change anything.

On the rule, i totally misunderstood it. Just to clarify, you mean that i can run a rule with for/while loop and send image using sendimage in this loop.

Thanks again.

Great thanks for confirming it works out of the box.

By rule i mean creating a rule that once a second sends the exact same ACTION and uses the same ID which is the first field of the action and allows you to delete and change the contents of the displayed message.

In theory from what I have read is that the image will update without the message going away.

Thanks i figured it out yesterday. I used a variable to help me understand how it was working.

below is the snippet of the image being updated 15. i do see the text changing on the notification and image also updates.

while((i=i+1) < 15) 
					{
					logInfo("Image","MsgID: " + i )
					getActions("androidnotifications", "androidnotifications:tvoverlaydisplay:TV").sendImage("1",i.toString,null, "download:http://frontcam.local/snapshot.jpg", null, null,null, null, 1)
					Thread::sleep(200)
					}

thanks for posting the code that works, so which method wins for your use case? Any feedback on what the result of doing it via updating the jpg over and over?

:smile: the jpg is fast superfast compared to video. It is exactly what my Kodi addon did and i was happy with it. Now iam happy again. I have new worries outside of your addon, ie the size of the image displayed on overlay. Iam having to debate keeping pipup or tvoverlay.

The addon is overall thumbs up, works as advertised.