erikkastelec / hass-WEM-Portal

Custom component for retrieving sensor information from Weishaupt WEM Portal
MIT License
44 stars 10 forks source link

Configuration error after 1.3.1 update #25

Closed mk-maddin closed 2 years ago

mk-maddin commented 2 years ago

Hi,

first of all big thank you for this integration :) I am using it since I have my weishaupt WWP LS-8 B and it is an awesome way to provide overview and control of my heating via home assistant :+1:

Unfortunately since the 1.3.1 release I am getting the following error (with my old configuration) after a restart - even thought the configuration check is fine:

sensor:
  - platform: wemportal
    username: !secret wemportal_usr
    password: !secret wemportal_pwd
    language: de
    # every 17min - default 30min = 1800 - not recommended below 15min = 900
    scan_interval: 1020
    # every 3min - default 5min = 500 - should not be lower than 180 = 3 minutes
    api_scan_interval: 180
    mode: both

2022-04-21 13:02:39 ERROR (MainThread) [homeassistant.config] Invalid config for [wemportal]: expected a dictionary for dictionary value @ data['wemportal']. Got None. (See ?, line ?). Please check the docs at https://github.com/erikkastelec/hass-WEM-Portal 2022-04-21 13:02:39 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration wemportal: Invalid config. 2022-04-21 13:02:40 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform wemportal.sensor: Unable to set up component.

If I now switch to the configuration as it is documented, I am receiving the following error on configuration check and if I ignore the check and reboot the system fully, HA does not even start up any more until I remove the configuration yaml part of the wemportal integration.. :(

wemportal:
  username: !secret wemportal_usr
  password: !secret wemportal_pwd
  language: de
  # every 17min - default 30min = 1800 - not recommended below 15min = 900
  scan_interval: 1020
  # every 3min - default 5min = 500 - should not be lower than 180 = 3 minutes
  api_scan_interval: 180
  mode: both

2022-04-21 12:59:34 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139934117552912] Error handling message: expected a dictionary for dictionary value @ data['wemportal']. Got None (invalid_format)

Any idea where my configuration is wrong?

erikkastelec commented 2 years ago

I would suggest you retype this part again by hand. It is possible that some unwanted characters were introduced when you copied configuration from github. Make sure you use spaces and not tabs (some editors do not convert a tab symbol into spaces).

If this doesn't help, let me know.

mk-maddin commented 2 years ago

Hi,

thanks for your help. Unfortunately still the same issue :(

2022-04-21 19:59:07 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Invalid data for call_service at pos 1: expected a dictionary for dictionary value @ data['wemportal'] 2022-04-21 19:59:07 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140198871495632] Error handling message: expected a dictionary for dictionary value @ data['wemportal']. Got None (invalid_format)

I completely retyped the wemportal configuration but still the same error. Even tried to replace the ! secret values with plain username & password, but still the same :(

dm82m commented 2 years ago

Please Post your wemportal config including the 5 lines before and 5 lines after them

erikkastelec commented 2 years ago

Is config moved to the left, so not under sensor or any other platform? I am struggling to reproduce this. You could also try pasting you config into yaml validator and see if it finds any issues. If this does not work and you don't have any sensitive information inside your config file you can post the full config to pastebin and provide the link to it here or send it to me directly.

mk-maddin commented 2 years ago

Thanks both for your help :)

Please Post your wemportal config including the 5 lines before and 5 lines after them

I am usually using packages & includes with one package per folder... so there is not really a line before and after :/ Never the less, based on your request I had the idea to add the wemportal integration topic directly into the configuration.yaml - no package and no !secret include. So my configuration.yaml looking now like this:

#https://www.home-assistant.io/integrations/default_config/
#default_config:

config: !include configuration.d/config.yaml
lovelace: !include configuration.d/lovelace.yaml
python_script: !include configuration.d/python_script.yaml
mqtt: !include configuration.d/mqtt.yaml
wake_on_lan: !include configuration.d/wake_on_lan.yaml
updater: !include configuration.d/updater.yaml
system_health: !include configuration.d/system_health.yaml
api: !include configuration.d/api.yaml
http: !include configuration.d/http.yaml
homeassistant: !include configuration.d/homeassistant.yaml
history: !include configuration.d/history.yaml
logbook: !include configuration.d/logbook.yaml
logger: !include configuration.d/logger.yaml
frontend: !include configuration.d/frontend.yaml
mobile_app: !include configuration.d/mobile_app.yaml
tankerkoenig: !include configuration.d/tankerkoenig.yaml
zone: !include_dir_merge_list configuration.d/zone.d/
cover: !include_dir_merge_list configuration.d/cover.d/
device_tracker: !include_dir_merge_list configuration.d/device_tracker.d/
switch: !include_dir_merge_list configuration.d/switch.d/
automation: !include_dir_merge_list configuration.d/automation.d/
input_boolean: !include_dir_merge_named configuration.d/input_boolean.d/
input_text: !include_dir_merge_named configuration.d/input_text.d/
input_select: !include_dir_merge_named configuration.d/input_select.d/
variable: !include_dir_merge_named configuration.d/variable.d/
sensor: !include_dir_merge_list configuration.d/sensor.d/
dummy: !include_dir_merge_list configuration.d/dummy.d/
notify: !include_dir_merge_list configuration.d/notify.d/
shell_command: !include_dir_merge_named configuration.d/shell_command.d/
binary_sensor: !include_dir_merge_list configuration.d/binary_sensor.d/
script: !include_dir_merge_named configuration.d/script.d/
group: !include_dir_merge_named configuration.d/group.d/
person: !include_dir_merge_list configuration.d/person.d/
light: !include_dir_merge_list configuration.d/light.d/
stream: !include configuration.d/stream.yaml
input_datetime: !include_dir_merge_named configuration.d/input_datetime.d/
energy: !include configuration.d/energy.yaml
recorder: !include configuration.d/recorder.yaml
pyscript: !include configuration.d/pyscript.yaml

wemportal:
  username: mywemportal@mail.com
  password: mypassword
  language: de
  # every 17min - default 30min = 1800 - not recommended below 15min = 900
  scan_interval: 1020
  # every 3min - default 5min = 500 - should not be lower than 180 = 3 minutes
  api_scan_interval: 180
  mode: both

This seems to work, but as soon as I include "!secret" for my username and/or password, I receive the error above again. So there seems to be some incompatibility with "!include & !secret" with this component :/

Is config moved to the left, so not under sensor or any other platform?

As said... I am using packages so as I understood packages it is resolved below:

homeassistant:
  packages:
      wemportal:
          username: mywemportal@mail.com
          password: mypassword
          language: de
          # every 17min - default 30min = 1800 - not recommended below 15min = 900
          scan_interval: 1020
          # every 3min - default 5min = 500 - should not be lower than 180 = 3 minutes
          api_scan_interval: 180
          mode: both   

You could also try pasting you config into yaml validator and see if it finds any issues.

That's unfortunately my first part of struggling. I can check and print out the resolved configuration if it is fine via: python3 -m homeassistant --script check_config --config "/config" -i But as the wemportal topic throws an error a fully resolved configuration is not possible :/

Never the less - I will try to setup a test environment and simplify my configuration there (as you see I have a lot of other things configured and used within my productive env) then do some test If I can reproduce the issue...

mk-maddin commented 2 years ago

so adding the following line to configuration.yaml:

wemportal: !include configuration.d/wemportal.yaml

and within wemportal.yaml:

username: mywemportal@mail.com
password: mypassword
language: de
# every 17min - default 30min = 1800 - not recommended below 15min = 900
scan_interval: 1020
# every 3min - default 5min = 500 - should not be lower than 180 = 3 minutes
api_scan_interval: 180
mode: both   

Seems to work, too. Just as soon as I add the configuration below packages there seems to be an issue...

erikkastelec commented 2 years ago

I am new to the concept of packages inside Home Assistant, what is the advantage? My configuration looks like the last one you pasted. I do not have wemportal under packages and it is on the same level as homeassistant: ( not under anything)

mk-maddin commented 2 years ago

I am new to the concept of packages inside Home Assistant, what is the advantage? My configuration looks like the last one you pasted. I do not have wemportal under packages and it is on the same level as homeassistant: ( not under anything)

Well you create e.g. a folder name "heating" within this folder (package) you can now define everything related to heating in it. This includes e.g. the YAML for wemportal integration, the YAML for homematic integration (if you have some homematic thermostats), but additionally all YAMLS for automations you do for heating (like if my window is open set themorstat A to 0), but additionally you can add your customize (so thermostat_ABC23453 should be friendly_name "Thermostat LivingRoom") and e.g. die logging settings for the integration wemportal & homematic.

So this means you can more order your configuration based on "logical topics" than on "structural requirements". A good explanation is here, too : https://www.danielmartingonzalez.com/en/yaml-files-by-package-in-home-assistant/

erikkastelec commented 2 years ago

I see, will try to figure out why this does not work or implement config flow (UI setup), which would replace yaml setup.

On Fri, Apr 22, 2022, 09:09 mk-maddin @.***> wrote:

I am new to the concept of packages inside Home Assistant, what is the advantage? My configuration looks like the last one you pasted. I do not have wemportal under packages and it is on the same level as homeassistant: ( not under anything)

Well you create e.g. a folder name "heating" within this folder (package) you can now define everything related to heating in it. This includes e.g. the YAML for wemportal integration, the YAML for homematic integration (if you have some homematic thermostats), but additionally all YAMLS for automations you do for heating (like if my window is open set themorstat A to 0), but additionally you can add your customize (so thermostat_ABC23453 should be friendly_name "Thermostat LivingRoom") and e.g. die logging settings for the integration wemportal & homematic.

So this means you can more order your configuration based on "logical topics" than on "structural requirements". A good explanation is here, too : https://www.danielmartingonzalez.com/en/yaml-files-by-package-in-home-assistant/

— Reply to this email directly, view it on GitHub https://github.com/erikkastelec/hass-WEM-Portal/issues/25#issuecomment-1106081996, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHLYMDQYN7OJ4GP4P47KMLVGJGA7ANCNFSM5T64HC5Q . You are receiving this because you commented.Message ID: @.***>

mk-maddin commented 2 years ago

Okay - I think I found it.

Is there a reason why you have defined the DOMAIN (which is the major part of the integration configuration) as optional? https://github.com/erikkastelec/hass-WEM-Portal/blob/32a213b9ecd4d08b7fa7280e9802351b33473051/custom_components/wemportal/__init__.py#L22

changing this line to: DOMAIN: vol.Schema(

fixed it for me (within my minmal test & productive environment).

Is this an option to go? Should I create a PR to change this? :)

erikkastelec commented 2 years ago

Nice cache, you can make a PR or wait for me to make the change and release it in the afternoon.

On Fri, Apr 22, 2022, 09:51 mk-maddin @.***> wrote:

Okay - I think I found it.

Is there a reason why you have defined the DOMAIN (which is the major part of the integration configuration) as optional?

https://github.com/erikkastelec/hass-WEM-Portal/blob/32a213b9ecd4d08b7fa7280e9802351b33473051/custom_components/wemportal/__init__.py#L22

changing this line to: DOMAIN: vol.Schema(

fixed it for me.

Is this an option to go? Should I create a PR to change this? :)

— Reply to this email directly, view it on GitHub https://github.com/erikkastelec/hass-WEM-Portal/issues/25#issuecomment-1106122807, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIHLYMBQPJHXYFCXT2KTS5TVGJLA7ANCNFSM5T64HC5Q . You are receiving this because you commented.Message ID: @.***>