BuongiornoTexas/pwdusage

how do I specify usage.json location ?

Closed this issue · 6 comments

Im getting this error:

{"Usage Engine Status": "599 Error loading usage engine configuration file (Usage engine JSON configuration file not found.\nSpecify 'USAGE_JSON' environment variable, provide 'usage.json' file in working directory, or provide valid path for CLI version.)."}

and I cant figure out the correct path to tell the container where my usage.json lives - it's in my "/volume3/docker/Powerwall-Dashboard/tools/usage-service" folder along with the rest of the docker files.

I've created the "USAGE_JSON" environment variable, but cant seem to specify the path correctly.

Im a docker noob, so have no idea what Im doing most of the time.

Have you created a powerwall.extend.yml in your Powerwall-Dashboard folder? (I assuming most likely, as I don't think you'd get the error above otherwise). There is probably an error in the specifics of your file.

Mine looks like this, the USAGE_JSON is an environment variable that tells the container where the directory is in the container file system, the volumes tells the container how to map the usage-service folder to the container. My best guess is that you need to edit your source to be /volume3/docker/Powerwall-Dashboard/tools/usage-service.

services:
    pwdusage:
        image: jasonacox/pwdusage:latest
        container_name: pwdusage
        hostname: pwdusage
        restart: always
        user: "1000:1000"
        volumes:
            - type: bind
              source: ./tools/usage-service
              target: /var/lib/pwdusage
              read_only: true
        ports:
            - target: 9050
              published: 9050
              mode: host
        environment:
            - USAGE_JSON=/var/lib/pwdusage/usage.json
        depends_on:
            - influxdb

Cheers, I’ll check your info.

I just went into the tools/usage-service directory and ran the build.sh file and then duplicated the example file to create the usage.json file, modified it with my influx db info and configured the peak / off peak data.

@BuongiornoTexas I found the issue, I needed to change the yaml as follows to use a valid user id for my server:

user: "1062:1062"

and then it worked. :)

Excellent! You can probably also use the PWD_USER environment variable (I haven't yet updated my code to follow the PWD approach).

Hmmmm, I was able to successfully run the test script with the following (pinched from the pwd yml files):

user: "${PWD_USER:-1000:1000}"

but when follwing the instructions of moving a copy called "powerwall.extend.yml" to the main dir and:

./compose-dash.sh stop
./compose-dash.sh up -d

Including powerwall.extend.yml
Running Docker Compose...
[+] Running 6/6
⠿ Container pypowerwall Running 0.0s
⠿ Container influxdb Running 0.0s
⠿ Container telegraf Running 0.0s
⠿ Container grafana Running 0.0s
⠿ Container pwdusage Started 11.6s
⠿ Container weather411 Running 0.0s

pwdusage takes a long time to start, and the Grafana /JSON steps produce a 599 error. Checking the test URL showed the following:

{"Usage Engine Status": "599 Error loading usage engine configuration file (Usage engine JSON configuration file not found.\nSpecify 'USAGE_JSON' environment variable, provide 'usage.json' file in working directory, or provide valid path for CLI version.)."}

any ideas?

Hmm, some progress:

{"Usage Engine Status": "599 Error loading usage engine configuration file (<urllib3.connection.HTTPConnection object at 0x7fec04643850>: Failed to establish a new connection: [Errno 111] Connection refused)."}

if I use the following config:

version: "3.5"

services:
    pwdusage:
        image: jasonacox/pwdusage:latest
        container_name: pwdusage
        hostname: pwdusage
        restart: always
        user: "${PWD_USER:-1000:1000}"
        volumes:
            - type: bind
              source: ./tools/usage-service
              target: /var/lib/pwdusage
              read_only: true
        ports:
            - target: 9050
              published: 9050
              mode: host
        environment:
            - USAGE_JSON=/var/lib/pwdusage/usage.json
        depends_on:
            - influxdb

I dont have a firewall active on this server, so im not sure why im getting connection refused?

EDIT: NVM, my fault, I forgot to update the server info in usage.json after trying your updated tarif