(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


  • 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%

    https://smarthome.community/topic/151/rapidjson-instead-of-cjson-and-dkjson
    https://smarthome.community/topic/179/luajit

    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.

    5acf4d18-5c1a-40d2-8b57-95b33d78c17e-image.png

    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@192.168.1.14,http://127.0.0.1:3480/data_request?id=lr_HTTP_VeraBridgeMirror_192.168.1.14,[{
      "default":"device.serviceId.name",
      "key":"mirror",
      "label":"Mirror",
      "type":"text"
    }])
    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@192.168.1.14":{"url":"http://127.0.0.1:3480/data_request?id=lr_HTTP_VeraBridgeMirror_192.168.1.14","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.


  • Nope port should not be needed. What version of ALTUI and openLuup are you running?
    I am fairly certain now that the plugin I published works since it is working for me. Have to look at other things...


  • AltUI v2.50.2549. Openluup v20.5.22. It's annoying that the logging does not give anything useful.


  • Could you provide a screenshot of your attribute screen as well as a list of all your variables? I really have no idea why it isn't working for you. I even just added a camera to my openLuup setup and had no problem so something else is different. Are you seeing the camera control screen? Can you send commands to the camera like pan and tilt? What browser are you using? Can you try a different browser?