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.


davidcole

6037 posts

Uber Geek

Trusted

#240638 18-Sep-2018 12:25
Send private message

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

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


Create new topic
marpada
476 posts

Ultimate Geek


  #2092740 18-Sep-2018 19:12
Send private message

So what's the actual error?




davidcole

6037 posts

Uber Geek

Trusted

  #2092829 18-Sep-2018 20:32
Send private message

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

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


davidcole

6037 posts

Uber Geek

Trusted

  #2092833 18-Sep-2018 20:36
Send private message

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

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 




Yoban
447 posts

Ultimate Geek


davidcole

6037 posts

Uber Geek

Trusted

  #2093849 20-Sep-2018 14:28
Send private message

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

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


Yoban
447 posts

Ultimate Geek


  #2094651 21-Sep-2018 17:04
Send private message

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.


davidcole

6037 posts

Uber Geek

Trusted

  #2094718 21-Sep-2018 17:57
Send private message

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

Home Assistant: Gigabyte AMD A8 Brix, Home Assistant with Aeotech ZWave Controller, Raspberry PI, Wemos D1 Mini, Zwave, Shelly Humidity and Temperature sensors
Media:Chromecast v2, ATV4 4k, ATV4, HDHomeRun Dual
Server
Host Plex Server 3x3TB, 4x4TB using MergerFS, Samsung 850 evo 512 GB SSD, Proxmox Server with 1xW10, 2xUbuntu 22.04 LTS, Backblaze Backups, usenetprime.com fastmail.com Sharesies Trakt.TV Sharesight 


Create new topic





News and reviews »

Air New Zealand Starts AI adoption with OpenAI
Posted 24-Jul-2025 16:00


eero Pro 7 Review
Posted 23-Jul-2025 12:07


BeeStation Plus Review
Posted 21-Jul-2025 14:21


eero Unveils New Wi-Fi 7 Products in New Zealand
Posted 21-Jul-2025 00:01


WiZ Introduces HDMI Sync Box and other Light Devices
Posted 20-Jul-2025 17:32


RedShield Enhances DDoS and Bot Attack Protection
Posted 20-Jul-2025 17:26


Seagate Ships 30TB Drives
Posted 17-Jul-2025 11:24


Oclean AirPump A10 Water Flosser Review
Posted 13-Jul-2025 11:05


Samsung Galaxy Z Fold7: Raising the Bar for Smartphones
Posted 10-Jul-2025 02:01


Samsung Galaxy Z Flip7 Brings New Edge-To-Edge FlexWindow
Posted 10-Jul-2025 02:01


Epson Launches New AM-C550Z WorkForce Enterprise printer
Posted 9-Jul-2025 18:22


Samsung Releases Smart Monitor M9
Posted 9-Jul-2025 17:46


Nearly Half of Older Kiwis Still Write their Passwords on Paper
Posted 9-Jul-2025 08:42


D-Link 4G+ Cat6 Wi-Fi 6 DWR-933M Mobile Hotspot Review
Posted 1-Jul-2025 11:34


Oppo A5 Series Launches With New Levels of Durability
Posted 30-Jun-2025 10:15









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.