Skip to content

Unable to use "timeout" argument in gateway instantiation #262

@kristianwiklund

Description

@kristianwiklund

Version:

pymysensors 0.20.1, installed by pip3

Environment:

Ubuntu 18.04.4 LTS, x86_64, python 3.6.9

Expected behavior

Instantiation of a tcp gateway object with altered timeouts. (If my testing of different versions isn't completely off, this worked in 0.18.0, but not from 0.19.0 and onwards.)

Actual behavior

TypeError: init() got an unexpected keyword argument 'timeout'

python3 mystest.py
Traceback (most recent call last):
  File "mystest.py", line 10, in <module>
    persistence_file='mysensors.pickle', protocol_version='1.4')
  File "/usr/local/lib/python3.6/dist-packages/mysensors/gateway_tcp.py", line 76, in __init__
    super().__init__(transport, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/mysensors/__init__.py", line 197, in __init__
    super().__init__(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/mysensors/gateway_tcp.py", line 23, in __init__
    super().__init__(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'timeout'

How to recreate:

Use code in README to instantiate a tcp gateway with a timeout as below

import mysensors.mysensors as mysensors

def event(message):
    """Callback for mysensors updates."""
    print("sensor_update " + str(message.node_id))

GATEWAY = mysensors.TCPGateway(
    '10.168.0.2', port=5003, timeout=1.0, reconnect_timeout=10.0,
    event_callback=event, persistence=True,
    persistence_file='mysensors.pickle', protocol_version='1.4')

GATEWAY.start()

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