I'm trying to set up the REST connector for Thingsboard IoT Gateway and getting some errors on initialization. My rest.json config is:
{
"host": "127.0.0.1",
"port": "5000",
"SSL": false,
"mapping": [
{
"endpoint": "/sizerdata",
"HTTPMethods": [
"POST"
],
"security": {
"type": "anonymous"
},
"converter": {
"type": "json",
"deviceNameExpression": "Sizer ${name}",
"deviceTypeExpression": "default",
"attributes": [
{
"type": "string",
"key": "serialNumber",
"value": "${serialNumber}"
}
],
"timeseries": [
{
"type": "integer",
"key": "cupfill",
"value": "${cupfill}"
},
{
"type": "integer",
"key": "packsPerHour",
"value": "${packsPerHour}"
},
{
"type": "integer",
"key": "totalFruitPerMinute",
"value": "${totalFruitPerMinute}"
}
]
}
}
]
}
When I start the thingsboard-gateway service I get the following errors in the logs:
""2021-12-29 13:09:07" - |ERROR| - [rest_connector.py] - rest_connector - run - 152 - web.Application instance initialized with different loop"
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/rest/rest_connector.py", line 150, in run
self.__run_server()
File "/usr/lib/python3/dist-packages/thingsboard_gateway/connectors/rest/rest_connector.py", line 143, in __run_server
web.run_app(self._app, host=self.__config['host'], port=self.__config['port'], handle_signals=False,
File "/var/lib/thingsboard_gateway/.local/lib/python3.8/site-packages/aiohttp/web.py", line 514, in run_app
loop.run_until_complete(main_task)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/var/lib/thingsboard_gateway/.local/lib/python3.8/site-packages/aiohttp/web.py", line 321, in _run_app
await runner.setup()
File "/var/lib/thingsboard_gateway/.local/lib/python3.8/site-packages/aiohttp/web_runner.py", line 279, in setup
self._server = await self._make_server()
File "/var/lib/thingsboard_gateway/.local/lib/python3.8/site-packages/aiohttp/web_runner.py", line 373, in _make_server
self._app._set_loop(loop)
File "/var/lib/thingsboard_gateway/.local/lib/python3.8/site-packages/aiohttp/web_app.py", line 223, in _set_loop
raise RuntimeError(
RuntimeError: web.Application instance initialized with different loop
I have tried this on an Ubuntu install and a Docker container and I get the same result. Any ideas on why this doesn't work?
It is an issue with aiohttp, it is already fixed in the master branch. You can use the version from the master branch of the gateway repository or wait for the next release.