Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


4053 posts

Uber Geek
+1 received by user: 535

Trusted

Topic # 240638 18-Sep-2018 12:25
Send private message quote this post

I've found this code on github for attaching to the dahua cameras:

 

https://github.com/drblez/dahuaevents2mqtt

 

I'm trying to make it into a container, but I've never looked at go before (why paddle when you can swim with sharks).

 

So what's I'm looking at is cloning the code to a local machine:

 

/src/dahuaevents2mqtt

 

Then using the following docker file to build it:

 

FROM golang:1.9
ARG version="0.0.1"
RUN mkdir -p /go/src/dahuaevents2mqtt
ADD . /go/src/dahuaevents2mqtt

 

WORKDIR /go/src/dahuaevents2mqtt
RUN go get .

 

RUN go build -o main .
#COPY . .
CMD ["/go/src/dahuaevents2mqtt/main"]

 

Now this seems to build, but fails in running with an error with syslog.  But I had a lot of issues figuring out how to add the dependancies (ie the code in separate .go files in subdirectories)

 

 

 

I think in these lines:

 

log = s

 

if err != nil {
    fmt.Printf("%s unable to start: %s", displayName, err)
    return
}

 

 

 

Does anyone have any guidance?  I'd like to build it and then start learning go to modify it for my purposes (at the moment it only deals with standalone cameras, and not an nvr).





Previously known as psycik

NextPVR: 
Gigabyte AMD A8 Brix --> Samsung LA46A650D via HDMI, NextPVR,
OpenHAB: ODroid C2 eMMC DriveOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 2012 
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


Create new topic
264 posts

Ultimate Geek
+1 received by user: 95


  Reply # 2092740 18-Sep-2018 19:12
Send private message quote this post

So what's the actual error?




4053 posts

Uber Geek
+1 received by user: 535

Trusted

  Reply # 2092829 18-Sep-2018 20:32
Send private message quote this post

marpada:

 

So what's the actual error?

 

 

I think it was "Unix syslog delivery error" which I belibe I've got around by removing go-service, and changing the log entries to log.logger.

 

Now I'v got a building and running docker image....just trying to figure out how to get the .json config file from the file system into the image on run time.

 

It seems to get the config with this line:

 

configuration := config.Init()

 

But I'll need to find if I can set the location and name of the config file.

 

 





Previously known as psycik

NextPVR: 
Gigabyte AMD A8 Brix --> Samsung LA46A650D via HDMI, NextPVR,
OpenHAB: ODroid C2 eMMC DriveOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 2012 
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex




4053 posts

Uber Geek
+1 received by user: 535

Trusted

  Reply # 2092833 18-Sep-2018 20:36
Send private message quote this post

Ahh, no, the config is a class thing imported, it's defaulting to dahuaevent2mqtt.json via an init method.

 

It looks like it can be overwritten in an environment variable.

 

 





Previously known as psycik

NextPVR: 
Gigabyte AMD A8 Brix --> Samsung LA46A650D via HDMI, NextPVR,
OpenHAB: ODroid C2 eMMC DriveOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 2012 
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


127 posts

Master Geek
+1 received by user: 8




4053 posts

Uber Geek
+1 received by user: 535

Trusted

  Reply # 2093849 20-Sep-2018 14:28
Send private message quote this post

Yeah I gave up on the go.  Too much I couldn't figure out for my limited attention span.

 

I've already got a windows service that mostly publishes everything to mqtt, so just added some features to that...ie it published an event after the fact, for either a single camera or nvr.   But I was wanting a snapshot image at the time of the event.  So I've modified my service to do that, and so now get an image to pushover (and could put it in slack also).  This is via mqttwarn as a receptacle for the mqtt message..I think i could get the same image posted to mqtt into openhab as an image item (which is cleaner than my current, pick up a local file thats curl'd every minute.

 

Camera support in home assistant is far superior to openhab.

 

 





Previously known as psycik

NextPVR: 
Gigabyte AMD A8 Brix --> Samsung LA46A650D via HDMI, NextPVR,
OpenHAB: ODroid C2 eMMC DriveOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 2012 
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


127 posts

Master Geek
+1 received by user: 8


  Reply # 2094651 21-Sep-2018 17:04
Send private message quote this post

I have seen a bit on MQTT and images, bit of "experience" needed before I go down that path which would require picking up the image once the camera had dumped it somewhere via FTP I am guessing.

 

Your Windows service sounds interesting - is this developed by yourself or open source somewhere? Any info?

 

I am playing with using my NAS and docker containers to drive it all with Home Assistant which will also allow for me to plug a zwave dongle in the USB port too. I am in early days yet and just getting my head around it all.




4053 posts

Uber Geek
+1 received by user: 535

Trusted

  Reply # 2094718 21-Sep-2018 17:57
Send private message quote this post

Yoban:

I have seen a bit on MQTT and images, bit of "experience" needed before I go down that path which would require picking up the image once the camera had dumped it somewhere via FTP I am guessing.


Your Windows service sounds interesting - is this developed by yourself or open source somewhere? Any info?


I am playing with using my NAS and docker containers to drive it all with Home Assistant which will also allow for me to plug a zwave dongle in the USB port too. I am in early days yet and just getting my head around it all.



Yeah developed by me. A windows service. But I’m contemplating trying to make it into a docker image and multi platform. Ive been running it for years and making tweaks to it.

Ideally python would be better and cross platform. But not there yet with my python skills.




Previously known as psycik

NextPVR: 
Gigabyte AMD A8 Brix --> Samsung LA46A650D via HDMI, NextPVR,
OpenHAB: ODroid C2 eMMC DriveOpenHAB with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave and Bluetooth LE Sensors
Media:Chromecast v2, ATV4, Roku3, HDHomeRun Dual
Windows 2012 
Host (Plex Server/Crashplan): 2x2TB, 2x3TB, 1x4TB using DriveBender, Samsung 850 evo 512 GB SSD, Hyper-V Server with 1xW10, 1xW2k8, 2xUbuntu 16.04 LTS, Crashplan, NextPVR channel for Plex,NextPVR Metadata Agent and Scanner for Plex


Create new topic

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.