Yes that’s exactly what I’m looking to do. I want 65% to be 100% on the fake light.
Here’s the code that I have now:
- platform: template
lights:
hallway_pendant:
value_template: >-
{% if is_state('light.hallway_pendant_deconz', 'on') %}
on
{% elif is_state('light.hallway_pendant_deconz', 'off') %}
off
{% else %}
unknown
{% endif %}
turn_on:
service: light.turn_on
data:
entity_id: light.hallway_pendant_deconz
turn_off:
service: light.turn_off
data:
entity_id: light.hallway_pendant_deconz
level_template: "{{ state_attr('light.hallway_pendant_deconz', 'brightness') | float / 0.65 }}"
set_level:
service: light.turn_on
data_template:
brightness: "{{ brightness * 0.65 }}"
I also tried:
set_level:
service: light.turn_on
data_template:
entity_id: light.hallway_pendant_deconz
brightness: "{{ brightness * 0.65 }}"
I can turn the fake template light on and off (and this turns the real light on and off) however the fake light isn’t correctly showing the level and the level cannot be set using the fake light.
Here are the errors I’m getting:
Logger: homeassistant.helpers.script.hallway_pendant
Source: helpers/script.py:1122
First occurred: 13:45:33 (10 occurrences)
Last logged: 13:48:15
hallway_pendant: Error executing script. Invalid data for call_service at pos 1: expected int for dictionary value @ data['brightness']
Logger: homeassistant.components.websocket_api.http.connection.547449866560
Source: core.py:1402
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 13:45:33 (8 occurrences)
Last logged: 13:45:48
expected int for dictionary value @ data['brightness']
Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1448, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1483, in _execute_service await handler.job.target(service_call) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service await self.hass.helpers.service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 482, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 519, in _handle_entity_call await result File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 249, in async_handle_light_on_service await light.async_turn_on(**params) File "/usr/src/homeassistant/homeassistant/components/template/light.py", line 332, in async_turn_on await self._level_script.async_run( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1010, in async_run await asyncio.shield(run.async_run()) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 245, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step await getattr( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in _async_call_service_step await service_task File "/usr/src/homeassistant/homeassistant/core.py", line 1402, in async_call processed_data = handler.schema(service_data) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 218, in __call__ return self._exec((Schema(val) for val in self.validators), v) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 336, in _exec v = func(v) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 215, in _run return self._exec(self._compiled, value, path) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 340, in _exec raise e if self.msg is None else AllInvalid(self.msg, path=path) File "/usr/local/lib/python3.8/site-packages/voluptuous/validators.py", line 338, in _exec v = func(path, v) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 817, in validate_callable return schema(data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 272, in __call__ return self._compiled([], data) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.8/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: expected int for dictionary value @ data['brightness']