How to use the rak811.Rak811TimeoutError function in rak811

To help you get started, we’ve selected a few rak811 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AmedeeBulle / pyrak811 / tests / test_cli.py View on Github external
def test_join_otaa_timeout(runner, mock_rak811):
    mock_rak811.return_value.join_otaa.side_effect = Rak811TimeoutError(
        'Timeout while waiting for event'
    )
    result = runner.invoke(cli, ['-v', 'join-otaa'])
    mock_rak811.return_value.join_otaa.assert_called_once()
    assert result.output == 'RAK811 timeout: Timeout while waiting for event\n'
github AmedeeBulle / pyrak811 / rak811 / cli.py View on Github external
def print_exception(e):
    """Print exception raised by the Rak811 library."""
    if isinstance(e, Rak811ResponseError):
        click.echo('RAK811 response error {}: {}'.format(e.errno, e.strerror))
    elif isinstance(e, Rak811EventError):
        click.echo('RAK811 event error {}: {}'.format(e.errno, e.strerror))
    elif isinstance(e, Rak811TimeoutError):
        click.echo('RAK811 timeout: {}'.format(e))
    else:
        click.echo('RAK811 unexpected exception {}'.format(e))