akx / hass-ruuvitag

Hass.io addon for Ruuvitag Weather Stations
MIT License
24 stars 7 forks source link

Error while trying to install #29

Open Hauki75 opened 4 years ago

Hauki75 commented 4 years ago

Hi,

I copied files and to /addons -folder and Ruuvitag shows ok as Local Add-on. But when I'm trying to install, I get error: ERROR (SyncWorker_4) [supervisor.docker.addon] Can't build local/armv7-addon-ruuvitag:0.3.0: The command '/bin/ash -o pipefail -c apk add --no-cache python build-base yarn git' returned a non-zero code: 1

I'm using Home Assistant 0.112.4 & HassOS 4.11 on Raspberry Pi4 B 4GB.

mlaurika commented 4 years ago

Edit the dockerfile to something like this:

ARG BUILD_FROM
FROM $BUILD_FROM as build

ENV LANG C.UTF-8

RUN apk add --no-cache nodejs libusb-dev bluez-dev linux-headers eudev-dev
RUN apk add --no-cache python build-base yarn git
RUN yarn global add node-gyp
COPY . /app
WORKDIR /app
RUN yarn
RUN ./node_modules/.bin/tsc

FROM ${BUILD_FROM}

ENV LANG C.UTF-8
RUN apk add --no-cache nodejs libusb-dev bluez-dev linux-headers eudev-dev
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/js /app
WORKDIR /app
#RUN setcap cap_net_raw+eip $(eval readlink -f `which node`)
CMD [ "node", "app.js" ]

ARG BUILD_ARCH
ARG BUILD_DATE
ARG BUILD_REF
ARG BUILD_VERSION

LABEL \
    io.hass.name="hass-ruuvitag" \
    io.hass.description="hass ruuvitag add-on" \
    io.hass.arch="${BUILD_ARCH}" \
    io.hass.type="addon" \
    io.hass.version=${BUILD_VERSION} \
    maintainer="AKX" \
    org.label-schema.description="hass-ruuvitag add-on" \
    org.label-schema.build-date=${BUILD_DATE} \
    org.label-schema.name="hass-ruubitag" \
    org.label-schema.schema-version="1.0" \
    org.label-schema.url="https://github.com/akx/hass-ruuvitag" \
    org.label-schema.usage="https://github.com/akx/hass-ruuvitag" \
    org.label-schema.vcs-ref=${BUILD_REF} \
    org.label-schema.vcs-url="https://github.com/akx/hass-ruuvitag" \
    org.label-schema.vendor="akx/hass-ruuvitag Github"

Then create build.json that looks something like this:

{
  "squash": false,
  "build_from": {
    "aarch64": "hassioaddons/base-aarch64:7.1.0",
    "amd64": "hassioaddons/base-amd64:7.1.0",
    "armhf": "hassioaddons/base-armhf:7.1.0",
    "armv7": "hassioaddons/base-armv7:7.1.0",
    "i386": "hassioaddons/base-i386:7.1.0"
  },
  "args": {}
}

That is how I got from your situation to success with RPI4B 2GB.

gurrier commented 4 years ago

I had the same error as the original poster and managed to progress somewhat with the suggestion above.

Now the addon builds, starts and I can find the YAML confg for each of my 3 ruuvitags in the Log tab of the addon. When I add them to the config, I now get a failure in the Logs that says...

Server got itself in trouble tag f8f9cc1548e8: failed 2 http://hassio/homeassistant/api/states/sensor.Porch Ruuvi_battery: 500 Internal Server Error

No idea what to do from here. Can anyone advise, please?

mlaurika commented 4 years ago

This sounds like a separate issue.

The solution provided here only makes the build succeed it does not alter the code or change the functionality of the plugin any way.

Error 500 sounds like a networking error to me.

Personally running the package (with latest hassio/homeassistant) on RPi 4 2GB and RPi 3 without any issues. What hw do you have? What is your config otherwise?

Hauki75 commented 4 years ago

I didn't get this to work so I used another way: https://github.com/balda/ruuvitag-discovery

akx commented 3 years ago

@tmugan Your problem is caused by an invalid name. Try e.g. porch_ruuvi.