i want to create two toggle buttons.
One for the AC, the other for the Heat.
When you hit the button, it turns on the unit (using one of the scripts).
When you hit the button again, it turns off the unit (either using the script or just turning it off).
Are you planning on using input button helpers or just buttons on a dashboard card? Both are workable, but the method needed depends on the choice of input.
A basic button card allows you to assign actions for tap. You can use those actions to call a script. To get the toggle action you have described, you will need a script that handles the logic of which button has been pressed and compare it to the current mode of your device. Your buttons will both call that script.
You can actually handle all the logic and actions in the script being called instead of using three separate scripts, but do yourself a favor and stop using devices⌠use entities instead.
The system cannot restart because the configuration is not valid: Invalid config for [switch]: required key not provided @ data[âplatformâ]. Got None. (See /config/configuration.yaml, line 79).
So I created a new script and tried it with your example.
The script saves.
Created a button. When I press the button, it turns on. When I press it again, nothing happens, it stays on. My button also shows Off.
no errors.
You are not using the action I said to use and, because of that, youâre not sending the mode data with your button action. You must use a call_service action. The condition in the script expects to receive a variable named âmodeâ, it you donât supply that, the script will not work as intended.
You need to decide which type of input you want to use before proceeding⌠it makes it difficult to help when you are jumping back and forth between button cards and Template switches.
My issue is the button. I clicked on show state, but it does not show it, but the big thing is when you hit the button, it does the turn on/off, but when its on, I expected the icon to turn that amber color like my other buttons, but it stays blue, which makes it hard to see if it ran.
In a Button card, show_state is based on the entity ID you supply in the entity field. If you donât supply an entity ID for it to monitor, then there will be no state shown. You can add the climate entity to the card configuration, but it wonât change the icon color the way you want⌠thatâs just not how it works with climate entities. It will just show the state value under the name:
The combination of dashboard card and method you have chosen does not lend itself to what you have just described as your goal.
Options:
Create a pair of Template binary sensors to use in as your entities in the standard Button cards you have already created.
Use the Template switches discussed earlier.
Use a different button card such as Mushroom Cards or the custom Button Card which have templating options to make them more flexible.
I am holding off on the color piece for now and since it is separate from my original if I need to look at this again will start a new thread.
Accepted your original solution thank you!
Hi Didgeridrew, â⌠but do yourself a favor and stop using devices⌠use entities insteadâ.
Iâm facing the same problem, and i would like to create an entity but i donât know how.
I have a Moes IR blaster which is ZHA functional using quirk. My purpose is to control an old air conditioner.
Now i can control it using scripts. How to create an entity for such device? Then I could use climate control.
alias: LG AC
fields:
code_name:
name: IR Code
description: The code to be blasted through the IR blaster
required: true
selector:
attribute:
entity_id: sensor.ir_blaster_codes
sequence:
- service: zha.issue_zigbee_cluster_command
data:
cluster_type: in
endpoint_id: 1
command: 2
ieee: 90:39:5e:ff:fe:2f:4c:7b
command_type: server
params:
code: "{{ state_attr('sensor.ir_blaster_codes', code_name) }}"
cluster_id: 57348
mode: single
icon: mdi:remote
Do you have a means of getting feedback from the AC unit?
You may be able to combine existing sensors with your script actions into a Template Switch then use that and a temperature sensor in the Generic Thermostat integration to create a usable climate entity. For the Template Switch you will need a way to know whether the AC is running.
Thank you for your time!
I canât understand how to bind climate entity here.
Lets say i have external thermometer, and i will buy a smart socket to monitor power state of the AC. I donât understand how to bind between thermostat temperature setpoint values, or modes? In order to change temperature i have to send a command with different code to the ir blaster.
No, you have to give over temperature control to HA.
1: Set up a Template Binary sensor. Use the value from the power monitoring sensor to define when the binary sensor is on or off. This will be used to provide the state for the Template switch.
2: Set up the Template Switch: The âturn onâ actions in in the switch configuration will be to send the codes to turn the unit on/set the temp to slightly lower the lowest value you want it to ever use. The âturn offâ actions send the codes to set the unit to idle or off.
Now I understand your point. It is simple on off operation.
I thought there is a way to create an entity that will open the functionality of AC - change the mode, set timers etcâŚ
Thank you.
The actions can be more complex, but you have to design the automations around the inputs and outputs available to you. Accurate and reliable automation without accurate or reliable sensing is difficult and often frustrating.
You havenât shared what type of AC unit you are using, but you may want to check out the following threads to see if your AC unit is compatible with the Midea hack: