austinmroczek / addon-solarman-mqtt

Home Assistant add-on to send data from the Solarman API to an MQTT broker
Apache License 2.0
0 stars 2 forks source link

Issue Start addon #21

Open RazorCopter opened 1 month ago

RazorCopter commented 1 month ago

`[17:52:15] INFO: Pull Solarman config from add-on [17:52:16] INFO: Solarman-MQTT config file does not exist. Generating from sample. [17:52:16] INFO: Generate Solarman passhash from password hash is 079c0bc4e33874ac34462977124b833640d232efea07dcb46294bd [17:52:16] INFO: Pull MQTT config from add-on [17:52:16] INFO: Creating Solarman-MQTT configuration file using the following configuration

{ "name": "Solarman", "url": "globalapi.solarmanpv.com", "appid": "2023050938171504", "secret": "da8a695b02c169e3cf57ea45e83b26c2", "username": "ghozzzss@gmail.com", "passhash": "079c85f70bc4e33874ac34462977124b833640d232efea07dcb46294bd", "stationId": 61215208, "inverterId": S2250L0012244, "loggerId": 2701739565, "debug": false, "mqtt":{ "broker": "10.0.0.100", "port": 1883, "topic": "solarmanpv", "username": "gianxito", "password": "gianxito", "qos": 1, "retain": true } }

[17:52:16] INFO: Solarman-MQTT configuration complete [17:52:16] INFO: Starting Solarman-MQTT daemon. Traceback (most recent call last): File "/app/solarman-mqtt/run.py", line 14, in main() File "/app/solarman-mqtt/run.py", line 10, in main solarman.main() File "/app/solarman-mqtt/solarman/init.py", line 44, in main solarman = SolarmanPV(args.file) File "/app/solarman-mqtt/solarman/solarmanpv.py", line 23, in init self.config = self.load_config(file) File "/app/solarman-mqtt/solarman/solarmanpv.py", line 31, in load_config config = json.load(config_file) File "/usr/lib/python3.9/json/init.py", line 293, in load return loads(fp.read(), File "/usr/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 9 column 17 (char 301) s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped`

i need support for this error

austinmroczek commented 1 month ago

I'll take a look and see what I can do.

First, I would highly recommend you change your Solarman password. The log info you posted about includes your password hash...but Solarman uses a weak hash method so someone could in theory back out your password.

I should probably make it so that sensitive info is not in the log like it is now.

RazorCopter commented 1 month ago

Obviously I replaced the keys before publishing the issue, (they are almost all fake data) I await your news thx

austinmroczek commented 1 month ago

Was it running properly at some point, or are you trying to get it started for the first time?

Are you using HassOS or Supervised?

austinmroczek commented 1 month ago

It looks like there's some issue with saving the config file. I've pushed a new version 2024.10.3 that has improved debug messages.

Please update and post result.

To update:

RazorCopter commented 1 month ago

Plug-in is run in:

Home Assistant


Log

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
[18:08:43] INFO: Starting Solarman-MQTT add-on
[18:08:43] INFO: Using Python 3.9.18
[18:08:43] INFO: Solarman-MQTT config file does not exist. Generating from sample.
[18:08:43] INFO: Pull Solarman config from HA add-on config
[18:08:44] INFO: Generate Solarman passhash from password
[18:08:44] INFO: Hash is 079c8567e0f8f70bc4e33874ac34462d232efea07dcb46294bd
[18:08:44] INFO: Pull MQTT config from HA add-on config
[18:08:44] INFO: Creating Solarman-MQTT configuration file
[18:08:44] INFO: Solarman-MQTT configuration complete. Starting daemon.
Traceback (most recent call last):
  File "/app/solarman-mqtt/run.py", line 14, in <module>
    main()
  File "/app/solarman-mqtt/run.py", line 10, in main
    solarman.main()
  File "/app/solarman-mqtt/solarman/__init__.py", line 44, in main
    solarman = SolarmanPV(args.file)
  File "/app/solarman-mqtt/solarman/solarmanpv.py", line 23, in __init__
    self.config = self.load_config(file)
  File "/app/solarman-mqtt/solarman/solarmanpv.py", line 31, in load_config
    config = json.load(config_file)
  File "/usr/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 9 column 17 (char 301)
s6-rc: info: service legacy-services: stopping
s6-rc: info: service legacy-services successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
austinmroczek commented 1 month ago

Thanks.

Does your password include special characters? Or other config entries?

My guess is I'm not properly escaping the special characters and that messes with the reading of the config file.

austinmroczek commented 1 month ago
json.decoder.JSONDecodeError: Expecting value: line 9 column 17 (char 301)

Line 9 of the config.json file is the InverterID, but it might be the previous line, which is StationID

RazorCopter commented 1 month ago

aaaaaaaaaaaaaa

RazorCopter commented 1 month ago

no special characters in the password it's like this: p1pp0p1pp0

RazorCopter commented 1 month ago

with the container : https://github.com/mpepping/solarman-mqtt that I forked and modified: https://github.com/RazorCopter/solarman-mqtt/blob/main/solarman/solarmanpv.py

"line 152" ''' if inverter_device_state == 1: '''

it works fine, do you do logic on "inverter_device_state" ?

austinmroczek commented 1 month ago

I am making my own container (similar to other HA addons). I just pull in his python code and feed it the configuration. I haven't modified the python code at all.

RazorCopter commented 1 month ago

Can you do it? I would like to try it, For those who use your addon nothing changes as I only removed one constraint on the inverter status