troykelly / hassio-addons

Addons for Home Assistant
Apache License 2.0
5 stars 11 forks source link

DahuaVTO2MQTT Outdated #27

Open liamstears opened 1 week ago

liamstears commented 1 week ago

I love the idea of being able to have DahuaVTO2MQTT as an add on but this is using an old outdated repo from elad, would it be possible to update and use the latest code from his gitlab? https://gitlab.com/elad.bar/DahuaVTO2MQTT

troykelly commented 1 week ago

It's a great idea - it's just a matter of time I'm afraid.

liamstears commented 1 week ago

It's a great idea - it's just a matter of time I'm afraid.

I'm guessing its not just a case of updating the dockerfile using parts from the dockerfile on his gitlab then?

```dockerfile
FROM python:3.12-alpine
MAINTAINER Elad Bar <elad.bar@hotmail.com>

WORKDIR /app

COPY . ./

RUN apk update && \
    apk upgrade && \
    apk add curl && \
    pip install -r /app/requirements.txt

ENV DAHUA_VTO_HOST=vto-host
ENV DAHUA_VTO_USERNAME=Username
ENV DAHUA_VTO_PASSWORD=Password
ENV MQTT_BROKER_HOST=mqtt-host
ENV MQTT_BROKER_PORT=1883
ENV MQTT_BROKER_USERNAME=Username
ENV MQTT_BROKER_PASSWORD=Password
ENV MQTT_BROKER_TOPIC_PREFIX=DahuaVTO
ENV MQTT_BROKER_CLIENT_ID=DahuaVTO2MQTT
ENV EXPORTER_PORT=9563

RUN chmod +x /app/DahuaVTO.py
RUN echo "{ \"version\": \"$(date +'%Y.%m.%d').$(( $(date +"%s") - $(date -d "$today 0" "+%s") ))\" }" > /app/data/version.json

HEALTHCHECK --interval=30s --timeout=3s CMD wget --spider http://127.0.0.1:${EXPORTER_PORT}/metrics

EXPOSE ${EXPORTER_PORT}

ENTRYPOINT ["python3", "/app/DahuaVTO.py"]
troykelly commented 1 week ago

Oh noooo.... If only it were that simple :-D

In four years the container environment for addons has significantly changed. This will be a complete rework, from scratch.

Nothing like the work @elad-bar has done to create the code - but unless their container is built on the hassio addon's container base - there's a fair bit to do to get it to be a HA Addon.

troykelly commented 1 week ago

@liamstears sorry I wasn't thinking last night - have you seen https://github.com/myhomeiot/DahuaVTO ?