Does above work, only for turning on i mean ( PS: i removed the “else”- )
No, that shows the pop-up again from where I can turn it on.
I mend as above, im trying to “build” upon what you said worked (you could turn on, but not of) so either trying “direct” on the entity, or call “external template”
Hmmm, never mind, that worked neither
Weird, it shouldn’t be that hard right? I think we’re really close but just missing something…
im pretty sure someone out there knows the “simple” missing-part
Let’s hope so…for now we’re the only one left in this topic
Could you do it with a script, where the script will do the toggling ?
In the docs it does say it can run scripts from the entity action.
- entity: climate.air_conditioning_air_care
name: Airco
value: mdi:air-conditioner
action:
- service: script.toggle_air_con
map_state:
off:
color: white
cool:
color: lightblue
heat:
color: darkred
wait !, is it called airco_switch now, And not ac_toggle ?? ( what is the sensor/switch actually called ? ) … in either this is the one you have to “toggle” (if it’s a switch)
That would be painful if that was all
But unfortunately I renamed the switch so it’s the correct name:
switch:
- platform: template
switches:
ac_switch:
friendly_name: "Airco_Switch"
turn_on:
service: climate.turn_on
target:
entity_id: climate.air_conditioning_air_care
turn_off:
service: climate.turn_off
target:
entity_id: climate.air_conditioning_air_care
Maybe you’re on to something but I really don’t know how to script, where to put the script etc… never done it. Can you give me some guidance on how to make this happen?
- entity: switch.ac_toggle
name: Airco
value: mdi:air-conditioner
tap_action:
action: call-service
service: switch.toggle
service_data:
entity_id: switch.ac_toggle
or this “toggle-switch”
Thou again, take it from scratch, find first out how/what turns it on , then what turns it off, , i.e does climate.turn_on vs climate.turn_off working ? , then go from there , sorry i don’t have climate. so i’ve just tested with lights,switch
And again climate(your AC) doesn’t seems to have a state “on” ( so you can’t toggle this, i guess ) however if your switch(normally only 2 states) on/of, you can toggle, same as light ( on/off )
try to make a simple “Automation” … trigger “click on button” / condition " if AC-state=off" / action “climate.turn_on” … when this(or similar) works, then in a “new” Automation/template (i.e if AC-state “not=off” Action “Climate.turn_off”)
Nope, at least I’m still with you two. But tbh, you lost me somewhere down the road…
Have you considered asking in the banner-card-thread? Maybe someone there knows an answer?
Needless to say, that banner-card seemed to have some issues, that should be solved by the new repository - you have done that, have you?
It’s a little hard to answer such specific questions, if one (me) hasn’t installed the component. If you ever decide to use button-card
instead, I’m your guy, just tag me.
Try this
- entity: any.light.switch.button.entity( i guess even climate.air_conditioning_air_care )
name: Airco
value: mdi:air-conditioner
tap_action:
action: call-service
service: script.test1
map_state:
cool:
color: lightblue
heat:
color: darkred
Then go to Settings/Scripts …
Create script: / Choose yaml-mode …paste below:
alias: test1
sequence:
- if:
- condition: state
entity_id: climate.air_conditioning_air_care
state: 'off'
then:
- service: climate.turn_on #if you have such service ! - and delete this commend
data: {}
target:
entity_id: climate.air_conditioning_air_care
else:
- service: climate.turn_off
data: {}
target:
entity_id: climate.air_conditioning_air_care
mode: single
Save it as test1 ( if the editor ask for id ) … you can even run a “test” inside the editor, as with automations
PS: my first simple script, through HA_script-editor ( GUI-mode )
EDIT: If this doesn’t work, request a FR in Github, for the Banner-Card ( tap_action on Icon )
YES!!! You did it! I’m so happy
A couple of small adjustments made and it works with the sensor as well so I can use the sensor state for the icon color…which is also great! Thanks for your effort and time…it has been really productive and I’ve learned a lot along the road
Final code for reference:
scripts.yaml:
ac_toggle:
alias: AC
sequence:
- if:
- condition: state
entity_id: climate.air_conditioning_air_care
state: 'off'
then:
- service: climate.turn_on
data: {}
target:
entity_id: climate.air_conditioning_air_care
else:
- service: climate.turn_off
data: {}
target:
entity_id: climate.air_conditioning_air_care
mode: single
banner-card:
- entity: climate.air_conditioning_air_care
domain: sensor
name: Airco
value: mdi:air-conditioner
action:
service: script.ac_toggle
map_state:
cool:
color: lightblue
heat:
color: darkred
off:
color: white
- it’s not a switch, nor a light , so you can’t use native services !
- climate don’t seems to have a "state_ “on” but rather it has several unique “states” , so howto “toggle” from state “on” ?
We know you can use this example or others, on any native switch/light etc. that have state i.e on/off ( obviously one can not “toggle” form i.e state “Heat” to Off nor “Heat” to Cool , unless you specify this in a script/template/or Automation
You can call climate.turn_on vs climate.turn_off, but not from one and the same entity(unless it’s a template-sensor) or your are calling a template/script/automation … problem here in Banner-Card is the “icon” as it’s rendered inside the card(if chosen to) not really the actual “entity-action-point” as this is just “Text”, that works fine to click-on ( without getting a “more-info” pop-up )
Cool, great to hear it works in your end also , yes i’ve learned also along the way here
I guess that’s the same for everyone But knowing a bit more about scripting opens some doors for me,…I won’t be bored this weekend
haha, yes, i’ve done a few automations, and templates on entities, but scripts haven’t been on the “menu” until now, and this one was quite easy, worked at 1st attempt(5min max), thou i did had some hours background_info to go on , so i guess thanks to @Holdestmade this was my “final” attempt … maybe , giving up have never been easy at hand , for me . I guess now “Script iT” will easy pop-up in my mind in alot of “situations” after this. Actually as easy as automations in GUI (when it comes to rather simple tasks), and a good way to learn how things/tasks works, start simple in GUI , check in Yaml … and if/then/else has been around since the 80th, when i learned first Basic programming.
But now, and in the GUI you’ll notice there’s alot variations on how to accomplice what’s on your mind
I’ve got some experience myself with C#, AutoIT, Basic (ofcourse) but I have to get used to the limitations and possibilities of YAML. For instance the indentation is something YAML is really strict with, besides that I’m still learning on what to use at which point. What can you ‘script’ in Lovelace, what to put in the configuration.yaml, what to put in script.yaml etc… Then there are also dependencies with different add-ons etc…
But giving up is never an option. When I think of something, I have to make it work…
I must say that this community is really great, everyone is willing to help and assist!