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

6020 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
474 posts

Ultimate Geek


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

So what's the actual error?




davidcole

6020 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

6020 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
445 posts

Ultimate Geek


davidcole

6020 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
445 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

6020 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 »

Logitech G522 Gaming Headset Review
Posted 18-Jun-2025 17:00


Māori Artists Launch Design Collection with Cricut ahead of Matariki Day
Posted 15-Jun-2025 11:19


LG Launches Upgraded webOS Hub With Advanced AI
Posted 15-Jun-2025 11:13


One NZ Satellite IoT goes live for customers
Posted 15-Jun-2025 11:10


Bolt Launches in New Zealand
Posted 11-Jun-2025 00:00


Suunto Run Review
Posted 10-Jun-2025 10:44


Freeview Satellite TV Brings HD Viewing to More New Zealanders
Posted 5-Jun-2025 11:50


HP OmniBook Ultra Flip 14-inch Review
Posted 3-Jun-2025 14:40


Flip Phones Are Back as HMD Reimagines an Iconic Style
Posted 30-May-2025 17:06


Hundreds of School Students Receive Laptops Through Spark Partnership With Quadrent's Green Lease
Posted 30-May-2025 16:57


AI Report Reveals Trust Is Key to Unlocking Its Potential in Aotearoa
Posted 30-May-2025 16:55


Galaxy Tab S10 FE Series Brings Intelligent Experiences to the Forefront with Premium, Versatile Design
Posted 30-May-2025 16:14


New OPPO Watch X2 Launches in New Zealand
Posted 29-May-2025 16:08


Synology Premiers a New Lineup of Advanced Data Management Solutions
Posted 29-May-2025 16:04


Dyson Launches Its Slimmest Vaccum Cleaner PencilVac
Posted 29-May-2025 15:50









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.