Hurray! That one nailed it
Tnx a lot!.
One problem still remains:
It seems that the set_level is passing the {{ brightness }} as a string to the service.
How can I pass this as an integer? Now my log says:
2019-01-17 17:27:11 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.1746806832] Error handling message: {'domain': 'light', 'service_data': {'brightness': 255, 'entity_id': 'light.bediening_licht_fornuis'}, 'type': 'call_service', 'service': 'turn_on', 'id': 16}
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/decorators.py", line 17, in _handle_async_response
await func(hass, connection, msg)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/websocket_api/commands.py", line 148, in handle_call_service
connection.context(msg))
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1121, in async_call
self._execute_service(handler, service_call))
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1143, in _execute_service
await handler.func(service_call)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/__init__.py", line 287, in async_handle_light_on_service
await light.async_turn_on(**pars)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/light/template.py", line 219, in async_turn_on
{"brightness": kwargs[ATTR_BRIGHTNESS]}, context=self._context)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 131, in async_run
await self._handle_action(action, variables, context)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action
action, variables, context)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service
context=context
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 85, in async_call_from_config
domain, service_name, service_data, blocking=blocking, context=context)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1121, in async_call
self._execute_service(handler, service_call))
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1145, in _execute_service
await self._hass.async_add_executor_job(handler.func, service_call)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/ads/__init__.py", line 96, in handle_write_data_by_name
ads.write_by_name(ads_var, value, ads.ADS_TYPEMAP[ads_type])
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/ads/__init__.py", line 153, in write_by_name
return self._client.write_by_name(name, value, plc_datatype)
File "/srv/homeassistant/lib/python3.5/site-packages/pyads/ads.py", line 533, in write_by_name
value, plc_datatype)
File "/srv/homeassistant/lib/python3.5/site-packages/pyads/pyads_ex.py", line 502, in adsSyncWriteByNameEx
port, address, ADSIGRP_SYM_VALBYHND, handle, value, data_type
File "/srv/homeassistant/lib/python3.5/site-packages/pyads/pyads_ex.py", line 301, in adsSyncWriteReqEx
data = plc_data_type(value)
TypeError: an integer is required (got type str)