Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for powermon in container is blank #394

Closed
frederickjh opened this issue Aug 22, 2023 · 11 comments
Closed

Documentation for powermon in container is blank #394

frederickjh opened this issue Aug 22, 2023 · 11 comments

Comments

@frederickjh
Copy link
Contributor

frederickjh commented Aug 22, 2023

Hello,
I am interest to switch from using the mpp-solar command to the powermon in my docker container. Looking at the available options for powermon, it looks like I could monitor and also setup morning and evening routines to be run.

However, currently in the documentation there is a title for "powermon with docker" but no text following it.

If this is currently possible any advice / documentation you can provide would be appreciated.
Thanks!

@frederickjh
Copy link
Contributor Author

I took a crack at trying to put together a powermon.yaml configuration file, however I am noticing that the documentation does not always agree with the files in mpp-solar/powermon/config. powermon -h does not offer any help on the configuration file either. Still not sure if I have this correct. Just wondering if powermon is a work in progress at this point.

@jblance
Copy link
Owner

jblance commented Aug 23, 2023 via email

@frederickjh
Copy link
Contributor Author

Okay understood. I am guessing that the sample configuration files are more up to date than the powermon config documentation.

@frederickjh
Copy link
Contributor Author

I was hopeful as the pi30max protocol that my inverter uses has been implemented. However I got an error:

$ powermon -C powermon-test.yaml 
Traceback (most recent call last):
  File "/usr/local/bin/powermon", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/dist-packages/powermon/__init__.py", line 152, in main
    schedule = Schedule.parseScheduleConfig(scheduling_config, device, mqtt_broker)
  File "/usr/local/lib/python3.10/dist-packages/powermon/libs/schedule.py", line 129, in parseScheduleConfig
    for schedule in config["schedules"]:
KeyError: 'schedules'

Sanitized powermon-test.yaml that I was used:

device:
  name: Inverter_1
  id: 92932108104635
  model: PIP8048MAX
  manufacturer: MPP-Solar
  port:
    type: usb
    path: /dev/hidraw1
    baud: 2400
    protocol: PI30MAX
commands:
- command: QPIGS
  trigger:
    every: 15
  outputs:
  - type: screen
    format: hass
- command: QLT
  trigger:
    every: 15
  outputs:
  - type: screen
    format: hass
- command: QET
  trigger:
    every: 15
  outputs:
  - type: screen
    format: hass
mqttbroker:
  name: 192.168.7.100
  port: 1883
  username: username
  password: xxxxxxxxxxxxxxxxxxxxx
  adhoc_commands:
    topic: Inverter_1/commands
    outputs:
    - name: screen
      tag: Inverter_1

Any ideas as to what I did not get correct in the config?

@jblance
Copy link
Owner

jblance commented Aug 24, 2023 via email

@frederickjh
Copy link
Contributor Author

@jblance Thanks for asking. I was testing on the host and forgot to update so I was using 0.15.57. Updated to 0.16.10 and the output to the screen seems to be working as I am seeing what look like data from the inverter but I am seeing an error show up in the output:

ERROR:usbport:send_and_receive@58: USB open error: 'USBPort' object has no attribute '_device'

I need to test more.

@jblance jblance closed this as completed Oct 19, 2023
@frederickjh
Copy link
Contributor Author

@jblance I see that you closed this but I do not find any documentation for powermon. I updated to the most recent version of mppsolar, 0.16.11-dev, that was just released and it looks like the configuration file syntax for powermon has changed a lot. I end up with a lot of type=missing errors.

powermon -D -V -C config/powermon-test.yaml                                                                                       418ms  [Sat Oct 21 2023 21:35:05 HST]
2023-10-21 21:35:31,805:INFO:__init__:main@116: Power Device Monitoring Utility, version: 0.16.11-dev, python version: 3.10.12
2023-10-21 21:35:31,805:INFO:__init__:main@122: Using config file: config/powermon-test.yaml
Config validation failed
config={'device': {'name': 'Inverter_1', 'id': '92932108104635', 'model': 'PIP8048MAX', 'manufacturer': 'MPP-Solar', 'port': {'type': 'usb', 'path': '/dev/hidraw1', 'baud': 2400, 'protocol': 'PI30MAX'}}, 'commands': [{'command': 'QPIGS', 'type': 'basic', 'trigger': {'every': 15}, 'outputs': [{'type': 'screen', 'format': {'type': 'hass'}}]}], 'mqttbroker': {'name': '192.168.7.100', 'port': 1883, 'username': 'mqtt_user', 'password': 'hthkMm3iC4xWwn-JyS7K'}, 'debuglevel': 10}
3 validation errors for ConfigModel
config.api
  Field required [type=missing, input_value={'device': {'name': 'Inve...S7K'}, 'debuglevel': 10}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing
config.daemon
  Field required [type=missing, input_value={'device': {'name': 'Inve...S7K'}, 'debuglevel': 10}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing
config.loop
  Field required [type=missing, input_value={'device': {'name': 'Inve...S7K'}, 'debuglevel': 10}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.4/v/missing

config/powermon-test.yaml

device:
  name: Inverter_1
  id: "245897456325784"
  model: PIP8048MAX
  manufacturer: MPP-Solar
  port:
    type: usb
    path: /dev/hidraw1
    baud: 2400
    protocol: PI30MAX
commands:
- command: QPIGS
  type: basic
  trigger:
    every: 15
  outputs:
  - type: screen
    format:
      type: hass
mqttbroker:
  name: 192.168.70.10
  port: 1883
  username: username
  password: xxxxxxxx

I had more "missing" errors when I started but managed to take care of some of them.

I also came across something you wrote in a different issue back in the middle of January

working in powermon command of mppsolar - requires a different config and only supports serial devices at the moment

Is it still the case that only serial connections are supported in powermon, as that maybe the problem I am facing as I was using a USB connection?

@rossandrews
Copy link
Contributor

I use USB without issues. Pydantic is a data validation library and I think something changed with the latest version since I have also found it be far more strict recently. I will add some sensible defaults for the api, daemon and loop config so they don't need to be included to pass validation.

@rossandrews
Copy link
Contributor

Here is my PR to help fix the issues your are having. #416

@jblance
Copy link
Owner

jblance commented Oct 23, 2023

Also powermon is still under heavy development, so isnt supported or recommended as yet

@frederickjh
Copy link
Contributor Author

Thanks for the replies. I will have another look at powermon after it is a bit more fully baked.

For now I have my own solution to monitoring and comands using mpp-solar. I have a docker container doing monitoring via the USB port on the inverter.

For commands, I have created configuration files for the commands that I want to run. This would be via the serial port on the inverter. With ssh key login setup from Home Assistant to the computer connected to the serial port so it can login and run commands. I have setup the commands that I want to run as shell scripts in HA. It then provides these as services that can be run from automations, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants