Skip to content

how to use as a node noob #2

@stefangweichinger

Description

@stefangweichinger

Can you help me getting started here?
I am looking for a way to extract temperature values from Varta devices for Prometheus and found your repo.

Can I send user/pwd with the requests? I have to auth at my storage.

I am a node noob, tried this:

> cat my.js 
// Access API Class Object
const battery = energyStorage({
  ip: '192.168.210.13',
  fullRequest: '/cgi/ems_data.js',
  simpleRequest: '/cgi/ems_data.xml',
  paramsRequest: '/cgi/ems_conf.js',
  type: 'v', // Type for VARTA Storage Systems
});

// Request the data from the Battery
await battery.requestSimple();

// Data can now be accessed in raw format, to use the provided methods, parse the data
battery.parse();

> npm install @robinrs/energy-storagejs 

added 7 packages in 250ms

❯ node my.js 
file:///tmp/tmp.TViuWogQFM/my.js:2
const battery = energyStorage({
                ^

ReferenceError: energyStorage is not defined
    at file:///tmp/tmp.TViuWogQFM/my.js:2:17
    at ModuleJob.run (node:internal/modules/esm/module_job:329:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)

Node.js v22.17.0

could you help out? Thanks for your work ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions