(Last Updated: November 23, 2020)
For those who registered but didn't received the confirmation email, please send an email to support@smarthome.community with the email you used

Amcrest/Dahua Camera Plugin streaming and PTZ for openLuup/ALTUI

  • Hi @rafale77,

    This is great! I have some Amcrest camera’s. Why isn’t this in the AltUI store? Any pointers on how to set this up?

  • Good question. I never thought about putting it up there because nobody asked. I certainly could post it there.
    The setup is very straightforward. Just put in the IP of the camera (it's a device attribute) and the credentials (these are variables) and it should work after a luup reload:
    I am using it to control preset positions PTZ so it changes position depending on time of the day.

    Screen Shot 2020-10-19 at 13.24.18.png

    Screen Shot 2020-10-19 at 13.24.46.png

    Screen Shot 2020-10-19 at 13.27.11.png

  • Great! I should put the files on openluup and then create a device, right?

  • Correct! Just the same way as the vera.

  • @rafale77 How do I install the plugin? I have created the device, but I don't have any variable "DirectStreamingURL" and where do I put in the username and password?

  • Bear with me a couple of days... I think I have learned enough lua now to be able to do a much better job and will rewrite it is such a way that will be easier to install.

  • Ok, that's cool. No hurry!

  • Ohh my gosh, shame on me... It turns out the version posted on github is not even the latest version I am running. I will be reposting in a few minutes.

    Edit: And now it should be much better. I also published the plugin on the AltAppStore.

  • @rafale77 Thanks for that! I have installed the plugin from the AltAppStore, but I'm getting the same result. No URL variable.

    And also the files on github seem to be the same (looking at the date).

  • You should only need to update 2 files (the I_ and the L_ files) which are 3 days old on GitHub? The url and username/password variables should all be autocreated upon luup reload.

  • I can't get it to work, the variables don't show up. I have even removed all files from openluup and started over, but same result every time. Any ideas?

  • Ok, I think I have now a pretty good idea of what happened. It would be helpful if you could look at your logs to find out what the error is though.
    The issue seems to be that my installation of openLuup is not quite "vanilla" as I have made a few minor modifications to it and am also running it on LuaJIT along with some additional libraries instead of the standard Lua5.1 interpreter. I will make a minor edit to try to fix it.
    Please try it and report back with what error you see in the logs if any.

    You can look into the openLuup section of the forum to see what changes I made to my openLuup installation. I basically decreased the CPU load by >75%


    Only change is to the L_Amcrest.lua file so you can just replace that file in your installation and reload.

  • @rafale77 said in Amcrest/Dahua Camera Plugin streaming and PTZ for openLuup/ALTUI:

    I basically decreased the CPU load by >75%

    ...although, it has to be said, from a pretty small starting level anyway?

  • @akbooer

    Yes, indeed:
    My setup with all the plugins and bridges was hovering around 6-8% CPU load with spikes to 14-18% when I opened an ALTUI page.
    Now I hover between 1.5-2.5% with spikes to 4-4.5% with ALTUI opened.

  • @rafale77 Thanks, I will test it tomorrow.

  • Released version 0.3 in the App store.
    I realized much simplification was possible with the newer versions of openLuup and that digest actually works with luajit.

  • Ok, we are a step further. All variables are there now. Firstly, there is a small error in the DirectStreamingURL though. The brackets should not be there.


    I have removed them, but still no image.

    This is the only thing I get in the log:

    2020-11-22 09:56:05.011   luup.variable_set:: 93.urn:micasaverde-com:serviceId:HaDevice1.CommFailureTime was: 0 now: 0 #hooks:0
    2020-11-22 09:56:05.011   openLuup.scheduler:: [93] Lobo device startup completed: status=true, msg=Ready, name=Lobo
    2020-11-22 09:56:05.011   openLuup.scheduler:: [297] Amcrest Dahua device startup
    2020-11-22 09:56:05.011   luup.set_failure:: status = false
    2020-11-22 09:56:05.011   luup.variable_set:: 297.urn:micasaverde-com:serviceId:HaDevice1.CommFailure was: false now: false #hooks:0
    2020-11-22 09:56:05.011   luup.variable_set:: 297.urn:micasaverde-com:serviceId:HaDevice1.CommFailureTime was: 1606035145 now: 1606035365 #hooks:0
    2020-11-22 09:56:05.011   luup.variable_set:: 297.urn:micasaverde-com:serviceId:HaDevice1.Commands was: camera_full_screen,camera_left,camera_right,camera_up,camera_down,camera_preset,camera_zoom_in,camera_zoom_out now: camera_full_screen,camera_left,camera_right,camera_up,camera_down,camera_preset,camera_zoom_in,camera_zoom_out #hooks:0
    2020-11-22 09:56:05.011   openLuup.scheduler:: [297] Amcrest Dahua device startup completed: status=, msg=, name=
    2020-11-22 09:56:05.012   luup_log:3: ALTUI: UPNPregisterDataProvider(3,Vera@,,[{
    2020-11-22 09:56:05.012   luup.variable_set:: 3.urn:upnp-org:serviceId:altui1.DataStorageProviders was: {"emoncms":{"url":"","callback":"sendValueToStorage_emoncms","parameters":[{"default":1,"type":"number","key":"node... now: {"Vera@":{"url":"","callback... #hooks:0
    2020-11-22 09:56:05.012   luup_log:3: ALTUI: UPNPregisterPlugin(3,urn:schemas-toggledbits-com:device:SiteSensor:1,J_SiteSensor1_ALTUI.js,SiteSensor_ALTUI.DeviceDraw,,,,SiteSensor_ALTUI.Favorite)
    2020-11-22 09:56:05.016   luup.variable_set:: 3.urn:upnp-org:serviceId:altui1.PluginConfig was: {"urn:schemas-micasaverde-com:device:PowerMeter:1":{"DeviceDrawFunc":"ALTUI_PluginDisplays.drawPowerMeter","ScriptF... now: {"urn:schemas-micasaverde-com:device:PowerMeter:1":{"ScriptFile":"J_ALTUI_plugins.js","DeviceDrawFunc":"ALTUI_Plugi... #hooks:0
    2020-11-22 09:56:05.017   luup_log:3: ALTUI: UPNPregisterPlugin(3,u

    BTW I have tried the complete URL in the browser and that works.

  • Good news is that the plugin code is executing.
    Stating the obvious but, did you check that the ip address and the credentials are setup?
    It is working fine here (with the brackets). The display of the stream/snapshot is actually done by ALTUI. depending on the browser you use, it may buffer a bit strangely.

  • I've put the ip-address in the attributes and the username and password in the variables yes. Maybe add the port? It doesn't need it when I put the URL directly in the browser, so probably not.