Skip to content

Powermon Configuration ‐ WIP

John Blance edited this page Mar 11, 2024 · 1 revision

powermon configuration

  • powermon expects the configuration to be in yaml and stored in a file that is specified to the command with the -C argument
  • powermon is built to run one instance per device (inverter / bms / shunt etc)
    • thus has exactly one port and one protocol defined
device        # specifies device details incl port and protocol
commands      # an array of commands and command configurations including output configs for each command
mqttbroker    # details of the mqttbroker
api           # details of the api
daemon        # configuration of the daemon

device

example config for a serially attached (likely USB to TTL or RS232 adapter) inverter from MPP-Solar

device:                    # required, but will create a test device with protocol PI30 if missing
  name: Inverter_6         # required, defaults to "unnamed_device" if not supplied
  id: 123456789            # optional, normally serial number
  model: 1012LV-MK         # optional
  manufacturer: MPP-Solar  # optional
  port:                    # required
    type: serial           # required, options test, serial, usb
    path: /dev/ttyUSB0     # options depend on port type - see next section
    protocol: PI30         # required, defaults to PI30 if not supplied

port types and options

type: serial       # for use with direct serial or USB to serial adapters
path: /dev/ttyUSB0 # required, defaults to '/dev/ttyUSB0' if not supplied
baud: 2400         # required, defaults to 2400 if not supplied 
type: usb          # for use with direct usb connections
path: /dev/hidraw0 # required, defaults to '/dev/hidraw0' if not supplied
type: test         # used for testing protocols, returns 'canned' responses that are defined in the protocol definition
response_number: 0 # optional, if not supplied will select one of the available test responses randomly

commands

  • the commands section can have 1 or multiple commands
  • each command can be a simple text command, or have additional information
device: 
  ...
commands:
- command: QPI # minimum is a single command
- command: QDI
  type: basic # optional, defaults to basic options: basic, ???

command triggers

  • when a command will run is controlled by the trigger, trigger types are every, at, loops
 ...
- command: QPI
  trigger:
    every: 25 # run every 25 seconds (approx)
- command: QDI
  trigger:
    at: "12:56" # run at 12:56 hours each day
- command: QMOD
  trigger:
    loops: 50 # rn every 50 loops (not recommended)

command outputs

  • the results of each command can be sent to one or more outputs, options are:
    • screen - just print the results to stdout
    • mqtt - send results to mqtt broker
...
# without an outputs definition, output will default to `screen`
- command: QPI    

# simplest outputs definition
- command: QMOD
  outputs: screen 

# more complete outputs definition, allowing for additional output configuration
- command: QDI
  outputs:
  - type: screen  

# outputs config with 2 outputs
- command: QPIGS
  outputs:        
  - type: screen
  - type: mqtt

command output formats

  • prior to being 'outputted' the results are processed through a formatter, formatters also have configuration options
  • available formats:
    • hass : home assistant suitable mqtt style messages
    • htmltable : htmltable of parameter / value / units
    • raw : the raw response
    • simple : parameter=value units
    • table : table of parameter / value / units formatted with spaces (default) or lines (draw_line = True)
    • topics :
...
- command: QDI

# more complete output definition, including format type
  outputs:
  - type: screen    
    format: simple  # simple is the default output format
- command: QMOD
  outputs:
  - type: screen
    # more complete format definition
    format: 
    - type: table           # display results in a table
      draw_lines: False     # use ascii box characters to outline the results table (default False)
      keep_case: False      # convert parameter name to lower case (default False)
      remove_spaces: True   # remove spaces in parameter name (default True)
      extra_info: False     # include extra_info from protocol definition (eg icon) in output, (default False)
      excl_filter: ^error   # exclude parameters that match regex (based on parameter format after processing
      filter: ^ac|^pv       # filter keyword to filter results, will display parameters that match the regex (processed after excl_filter)