Skip to content

ERROR:websocket:error from callback #36

Open

Description

@realdognose

Hello,

i've just downloaded and installed the latest version of wattpilot.

Now, there are the following errors. It seems, like the app is now frequently restarting it's readout proceedure and when it encounters this error, it restarts / reconnects.

Therefore only a tiny fraction of MQTT Values are published every 10,15 Seconds.

Is this a bug, or a configuration issue / incompatibility?

INFO:wattpilot:Connected to WattPilot Serial 91003433
INFO:wattpilot:Authentication successful
ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x000001F423933250>>: 'acl'
INFO:websocket:Websocket connected
INFO:wattpilot:Connected to WattPilot Serial 91003433
INFO:wattpilot:Authentication successful
ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x000001F423933250>>: 'acl'
INFO:websocket:Websocket connected
INFO:wattpilot:Connected to WattPilot Serial 91003433
INFO:wattpilot:Authentication successful
ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x000001F423933250>>: 'acl'
INFO:websocket:Websocket connected
INFO:wattpilot:Connected to WattPilot Serial 91003433
INFO:wattpilot:Authentication successful
ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x000001F423933250>>: 'acl'

only 5 of all properties are published to mqtt.

image

every now and then, the error message is chjanged to

wattpilot> ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x000002CB5B213250>>: 'rfd'

and a different set of mqtt-properties is exported, still not complete, though.

Activity

  1. realdognose commented on Aug 17, 2023

    @realdognose
    Author

    When I try to display the raw value output from within the console, I receive the following errors, which might be related:

    wattpilot> rawvalues
    List raw values of properties (without value mapping):
    Traceback (most recent call last):
      File "<frozen runpy>", line 198, in _run_module_as_main
      File "<frozen runpy>", line 88, in _run_code
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Scripts\wattpilotshell.exe\__main__.py", line 7, in <module>
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\site-packages\wattpilot\wattpilotshell.py", line 1166, in main
        wpsh.cmdloop()
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\cmd.py", line 138, in cmdloop
        stop = self.onecmd(line)
               ^^^^^^^^^^^^^^^^^
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\cmd.py", line 217, in onecmd
        return func(arg)
               ^^^^^^^^^
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\site-packages\wattpilot\wattpilotshell.py", line 437, in do_rawvalues
        props = self._get_props_matching_regex(arg)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\site-packages\wattpilot\wattpilotshell.py", line 642, in _get_props_matching_regex
        props = {k: v for k, v in props.items() if re.match(r'^'+value_regex+'$',
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\site-packages\wattpilot\wattpilotshell.py", line 643, in <dictcomp>
        str(mqtt_get_encoded_property(wpdef["properties"][k], v)), flags=re.IGNORECASE)}
                                      ~~~~~~~~~~~~~~~~~~~^^^
    KeyError: 'acl'
    
  2. realdognose commented on Aug 17, 2023

    @realdognose
    Author

    So, I figured out, that "adding" keys to the yaml file fixes the errors for one value at a time - but after adding about 30 keys, I stopped.

    I've then looked at the line from the error, where clearly the properties-collection is accessed without checking, if the key exists.

    I'm not familiar with python, but tried to modify the line from

    props = {k: v for k, v in props.items() if re.match(r'^'+value_regex+'$', str(mqtt_get_encoded_property(wpdef["properties"][k], v)), flags=re.IGNORECASE)}

    to

    props = {k: v for k, v in props.items() if k in self.wpdef["properties"] and re.match(r'^'+value_regex+'$', str(mqtt_get_encoded_property(self.wpdef["properties"][k], v)), flags=re.IGNORECASE)}

    but this only yields the error

    File "C:\Users\Administrator.EQUINOX\AppData\Local\Programs\Python\Python311\Lib\site-packages\wattpilot\wattpilotshell.py", line 642, in <dictcomp> props = {k: v for k, v in props.items() if k in self.wpdef["properties"] and re.match(r'^'+value_regex+'$', str(mqtt_get_encoded_property(self.wpdef["properties"][k], v)), flags=re.IGNORECASE)} ^^^^^^^^^^ AttributeError: 'WattpilotShell' object has no attribute 'wpdef'

    So, that line isn't working at all, because the attribute doesnt exist. Quoting the line completly makes "rawvalues" command work again.


    Putting everything together, the errors i'm seeing is because there are missing "keys" in the yaml file. I have the 22kw GO-Edition, maybe it has different key-sets in the api?

  3. klsystem1 commented on Nov 10, 2023

    @klsystem1

    Same Problem with Version 0.2:

    ERROR:wattpilot:Error received from WebSocketApp: 'ets'
    ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x7679bdd8>>: 'ets'
    ERROR:wattpilot:Error received from WebSocketApp: 'ets'
    ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x7679bdd8>>: 'ets'
    ERROR:wattpilot:Error received from WebSocketApp: 'ets'

    List raw values of properties (without value mapping):
    ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x7679bdd8>>: 'ets'
    ERROR:wattpilot:Error received from WebSocketApp: 'ets'
    Traceback (most recent call last):
    File "/usr/local/lib/python3.10/site-packages/cmd2-2.4.3-py3.10.egg/cmd2/cmd2.py", line 2399, in onecmd_plus_hooks
    stop = self.onecmd(statement, add_to_history=add_to_history)
    File "/usr/local/lib/python3.10/site-packages/cmd2-2.4.3-py3.10.egg/cmd2/cmd2.py", line 2852, in onecmd
    stop = func(statement)
    File "/usr/local/lib/python3.10/site-packages/wattpilot-0.2-py3.10.egg/wattpilot/wattpilotshell.py", line 457, in do_rawvalues
    props = self._get_props_matching_regex(arg)
    File "/usr/local/lib/python3.10/site-packages/wattpilot-0.2-py3.10.egg/wattpilot/wattpilotshell.py", line 680, in _get_props_matching_regex
    props = {k: v for k, v in props.items() if re.match(r'^'+value_regex+'$',
    File "/usr/local/lib/python3.10/site-packages/wattpilot-0.2-py3.10.egg/wattpilot/wattpilotshell.py", line 681, in
    str(mqtt_get_encoded_property(self.wpdef["properties"][k], v)), flags=re.IGNORECASE)}
    KeyError: 'acl'
    EXCEPTION of type 'KeyError' occurred with message: 'acl'
    wattpilot> ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x7679bdd8>>: 'ets'
    ERROR:wattpilot:Error received from WebSocketApp: 'ets'
    ERROR:websocket:error from callback <bound method Wattpilot.__on_message of <wattpilot.Wattpilot object at 0x7679bdd8>>: 'ets'
    ERROR:wattpilot:Error received from WebSocketApp: 'ets'

  4. added a commit that references this issue on Jan 4, 2024
    2ade998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions