dm82m / hass-Deltasol-KM2

Custom component for retrieving sensor information from Resol KM1/KM2, DL2/DL3, VBus/LAN, VBus/USB
MIT License
25 stars 6 forks source link

Error while setting up deltasol platform for sensor #5

Closed Steff6666 closed 2 years ago

Steff6666 commented 2 years ago

Hi,

Thanks for your this custom component, I really hope I can get it to work.

Installed from HACS and got two (2) errors after restart and can not get it to work.

Logs say...

Error 1: Logger: homeassistant.components.sensor Source: custom_components/deltasol/sensor.py:73 Integration: Sensor (documentation, issues) First occurred: 00:41:49 (1 occurrences) Last logged: 00:41:49

Error while setting up deltasol platform for sensor Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform await asyncio.shield(task) File "/config/custom_components/deltasol/sensor.py", line 73, in async_setup_platform DeltasolSensor(coordinator, _name, values[1], values[2]) for _name, values in coordinator.data.items() AttributeError: 'NoneType' object has no attribute 'items'

Error 2: Logger: custom_component.deltasol Source: custom_components/deltasol/deltasolapi.py:33 Integration: deltasol (documentation, issues) First occurred: 00:41:49 (1 occurrences) Last logged: 00:41:49

Unexpected error fetching deltasol_km2_sensor data: Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh self.data = await self._async_update_data() File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data return await self.update_method() File "/config/custom_components/deltasol/sensor.py", line 54, in async_update_data data = await hass.async_add_executor_job(api.fetch_data) File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run result = self.fn(*self.args, self.kwargs) File "/config/custom_components/deltasol/deltasolapi.py", line 33, in fetch_data response = requests.request("POST", url, headers=headers, data = payload).json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, kwargs) File "/usr/local/lib/python3.9/site-packages/simplejson/init.py", line 525, in loads return _default_decoder.decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

yaml file:

sensor:

dm82m commented 2 years ago

Format of scan_interval is wrong: it should be only a number in seconds. Change that and restart.

Steff6666 commented 2 years ago

I changed it to just a number 30, ...and restarted but still getting same errors. Even tried to remove it , but both errors are the same and no sensors are found.

dm82m commented 2 years ago

Can you put that into your browser and post me the results: http://192.168.1.124/cgi-bin/resol-webservice

Steff6666 commented 2 years ago

vendor = "RESOL" product = "DL2" serial = "001E664234FC" version = "2.2.4" build = "201909120704" name = "DL2-001E664234FC" features = "vbus,dl2,jobparam"

dm82m commented 2 years ago

You have a DL2 and no KM2 so this plugin is not yet suiting your needs.

dm82m commented 2 years ago

But you can have a look here and test it out and tell us if that works: https://github.com/dm82m/hass-Deltasol-KM2/issues/3

Steff6666 commented 2 years ago

Thanks for your support! I tried to find out how to copy the two files, but so far I have not managed. I can open the files and copy the content and then paste it in new files...but the formatting and lines are not copied correctly. Im a newbie to this and appreciate all help a lot, thanks!

dm82m commented 2 years ago

you can copy the content of both files from the following links and need to replace the content with them in your home assistant folder. after that you need to put mode: dlx into the sensor definition (equal to host). it should look like:

https://raw.githubusercontent.com/dm82m/hass-Deltasol-KM2/7f52cf6d9810aa266150b12bbf6b8d6de0e88c59/custom_components/deltasol/deltasolapi.py https://raw.githubusercontent.com/dm82m/hass-Deltasol-KM2/7f52cf6d9810aa266150b12bbf6b8d6de0e88c59/custom_components/deltasol/sensor.py

sensor:
  - platform: deltasol
    host: your_deltasol_hostname_or_ip_address
    username: your_username
    password: your_password
    api_mode: dlx

and then restart your home assistant instant and provide feedback here.

Steff6666 commented 2 years ago

Im getting this error now Invalid config for [sensor.deltasol]: [mode] is an invalid option for [sensor.deltasol]. Check: sensor.deltasol->mode. (See ?, line ?).

I added the raw text in existing files in HA and attach them here, I hope they are correct.

Deltasol.zip

dm82m commented 2 years ago

ah sorry, it is api_mode not mode. changed it above in my last post

Steff6666 commented 2 years ago

its changed , but still error Invalid config for [sensor.deltasol]: [api_mode] is an invalid option for [sensor.deltasol]. Check: sensor.deltasol->api_mode. (See ?, line ?).

dm82m commented 2 years ago

@chiefdeputy can you have a look here

i guess it should be mode and not api_Mode and also the files @steff6666 provided seems to be the correct ones.

@steff6666 but you restarted home assistant server after you made the changes to the python files - right?

Steff6666 commented 2 years ago

No its not restarted yet...I was thinking the same that this could be the reason. The reason was that it was not possible to restart because the yaml file was invalid. I will ignore the "mode" to get a valid config file->restart-> put mode back....give me some minutes

dm82m commented 2 years ago

Yes, without a restart it can’t work. Leave mode away, restart, add mode: dlx and restart again

Steff6666 commented 2 years ago

I´m having issues with HA, because of the sensor.py file. The validation of yaml file is not possible. When I try to restart It say (unicode error) utf-8´codec can't decode byte 0xb0 in position 0: invalid start byte (sensor.py, line 145). Maybe the .py files are not correct after my updates?

Steff6666 commented 2 years ago

It was the degree symbol that cause the problem. Just removed it and now configuration is fine. Restarted HA -> put mode: dlx in -> checked configuration and it was fine -> restarted. No errors in logs now!

Next step is to find sensors...but can not find any Deltasol sensors so far...

Steff6666 commented 2 years ago

YES!! I found the sensors now. They are named just sensor.temperature etc without any "DeltaSol" in the name...is that correct? Thanks a lot for your help!

Skärmavbild 2022-02-06 kl  13 54 10 Skärmavbild 2022-02-06 kl  13 53 46
dm82m commented 2 years ago

yes thats it, I am just releasing a new official version so you can update the plugin in a few minutes.

Steff6666 commented 2 years ago

Great! How to do with Unicode '°C' ? HA stopped working for me because of this degree symbol.

dm82m commented 2 years ago

release is out, can you please upgrade to 0.1.0 and tell me if this also solves your unicode problem?

dm82m commented 2 years ago

I close here. In case there is a Unicode issue please file a new bug!

Steff6666 commented 2 years ago

Just upgraded and all works fine and no problem with unicode. Thanks!