Terr
(Terr)
June 6, 2018, 1:07pm
1
I looked a lot of topics on this issue and I have two working solutions as i want
but
i dont like first solution because it seems to me that this option is too cumbersome and it should be easier to implement
and
i dont like second solution because i could not find an easy way to make the icons of input_boolean (for example, icon: mdi:desktop-classic) change colors to yellow when state is on as switch
so I ask for help
1 )
customize:
input_boolean.test_boolean1:
assumed_state: true
hidden: true
switch.test_boolean1:
assumed_state: true
input_boolean:
test_boolean1:
name: test_boolean1
switch:
- platform: template
switches:
test_boolean1:
value_template: "{{ is_state('input_boolean.test_boolean1', 'on') }}"
turn_on:
service: script.turn_on
entity_id: script.ontest
turn_off:
service: script.turn_on
entity_id: script.offtest
script:
ontest:
sequence:
- service: script.turn_on
entity_id: script.teston
- service: input_boolean.turn_on
entity_id: input_boolean.test_boolean1
offtest:
sequence:
- service: script.turn_on
entity_id: script.testoff
- service: input_boolean.turn_off
entity_id: input_boolean.test_boolean1
2 )
customize:
input_boolean.test_boolean:
assumed_state: true
input_boolean:
test_boolean:
name: test_boolean
automation:
- alias: "test_boolean_on"
trigger:
- platform: state
entity_id: input_boolean.test_boolean
to: 'on'
action:
service: script.turn_on
entity_id: script.teston
- alias: "test_boolean_off"
trigger:
- platform: state
entity_id: input_boolean.test_boolean
to: 'off'
action:
service: script.turn_on
entity_id: script.testoff
lolouk44
(lolouk44)
June 6, 2018, 2:10pm
2
Can you format your code using the blue bar on top of the page please?
It’s really difficult to read otherwise and assess potential code syntax issues.
try this:
homeassistant:
customize:
input_boolean.notify_motion:
templates:
icon: >
if (state === 'on') return 'mdi:run-fast';
return 'mdi:eye-off';
icon_color: >
if (state === 'on') return 'rgb(251, 210, 41)';
return 'rgb(54, 95, 140)';
of course change name and specifics to your liking
For option 1, you don’t really need the scripts. You can simplify the switch by combining them like this:
switch:
- platform: template
switches:
test_boolean1:
value_template: "{{ is_state('input_boolean.test_boolean1', 'on') }}"
turn_on:
- service: script.turn_on
entity_id: script.teston
- service: input_boolean.turn_on
entity_id: input_boolean.test_boolean1
turn_off:
- service: script.turn_on
entity_id: script.testoff
- service: input_boolean.turn_off
entity_id: input_boolean.test_boolean1
Terr
(Terr)
June 6, 2018, 2:37pm
5
sor
first week on HA
first post on forum
)
input_boolean.test_boolean:
assumed_state: true
templates:
icon: >
if (state === 'on') return 'mdi:run-fast';
return 'mdi:eye-off';
icon_color: >
if (state === 'on') return 'rgb(251, 210, 41)';
return 'rgb(54, 95, 140)';
dont work
show standart icon of input_boolean - not mdi:run-fast or mdi:eye-off
HA 0.70.1
Terr
(Terr)
June 6, 2018, 2:44pm
6
NotoriousBDG:
For option 1, you don’t really need the scripts. You can simplify the switch by combining them like this:
switch:
- platform: template
switches:
test_boolean1:
value_template: "{{ is_state('input_boolean.test_boolean1', 'on') }}"
turn_on:
- service: script.turn_on
entity_id: script.teston
- service: input_boolean.turn_on
entity_id: input_boolean.test_boolean1
turn_off:
- service: script.turn_on
entity_id: script.testoff
- service: input_boolean.turn_off
entity_id: input_boolean.test_boolean1
crap, i tried such but a little else
service: script.turn_on
entity_id: script.testoff
service: input_boolean.turn_off
entity_id: input_boolean.test_boolean1
and it showed me error with duplications
dont understand yet when i must use
- service: script.turn_on
entity_id: script.testoff
and when
service: script.turn_on
entity_id: script.testoff
thx man
1 Like
yes it does, probably something else is not in order, maybe you havent yet installed Custom-ui?
Terr
(Terr)
June 6, 2018, 2:53pm
8
true
I have not gotten to Custom-ui yet
then what I want can not be done by standard means without Custom-ui?
A lot can be done, I suggest you read up first: https://www.home-assistant.io/docs/configuration/customizing-devices/
Custom-Ui takes things a step further though …