Receiving UDP traffic


#21

Hi, I am an absolute HA beginner trying to follow your instructions, but HA throws the following error at me:

2018-10-21 21:43:39 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/helpers/discovery.py", line 160, in async_load_platform
    hass, component, hass_config)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/setup.py", line 45, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/helpers/discovery.py", line 160, in async_load_platform
    hass, component, hass_config)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/setup.py", line 45, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/config_entries.py", line 439, in async_forward_entry_setup
    self.hass, component, self._hass_config)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/setup.py", line 45, in async_setup_component
    return await setup_tasks[domain]  # type: ignore
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/setup.py", line 56, in async_setup_component
    return await task  # type: ignore
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/setup.py", line 118, in _async_setup_component
    conf_util.async_process_component_config(hass, config, domain)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/config.py", line 759, in async_process_component_config
    platform = get_platform(hass, domain, p_name)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/loader.py", line 60, in get_platform
    return get_component(hass, PLATFORM_FORMAT.format(domain, platform))
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/site-packages/homeassistant/loader.py", line 92, in get_component
    module = importlib.import_module(path)
  File "/volume1/[email protected]/AppCentral/python3/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/volume1/homeassistant/custom_components/sensor/udp.py", line 119, in <module>
    self._state = self._data[:200]
NameError: name 'self' is not defined

What to do now?


#22

Hi there,

Given the error type and given that the original file has an empty line at line 119, it seems as if the script was somehow mangled when you copied/pasted it - and indentation does matter with python.

Can you please make sure you have a proper copy of the file? You could directly save the raw version at:
https://raw.githubusercontent.com/glpatcern/domotica/master/homeass/code/udp.py

Cheers,
Giuseppe


#23

Thank you for your quick reply! I have downloaded the mint file as instructed and will test this as soon as I have the possibility, which is not before next Saturday.

Hans Frederik


#24

Hello,

Thanks for the great UDP component. Unfortunately, I get the error message:

Unable to bind on port 9102: [errno -2] Name does not resolve

Probably the Docker container can not hear outside. Since I’m running ‘Home Assistant’ on Hassio, I’m not sure how to open the port with ‘–net=host’ or ‘-p’.

Maybe somebody can help me.

many Greetings
Michael


#25

@MichaelR
Have you tried installing Portainer and fiddling with the container settings in there?
!!!(CAUTION)!!!
Make sure you have backed up first!! If it goes wrong don’t blame me, but there should be a way to publish ports or create the mappings needed, I think.

Rgds

John