When I run this script with the button, I am getting this error:
Stopped because an error was encountered at July 13, 2023 at 12:58:17 PM (runtime: 0.01 seconds)
expected float for dictionary value @ data[‘temperature’]
A user here helped me setup my button.
I am creating a button that turns on my AC in the garage, but it also sets the hvac mode to cool and sets the temperature to 72.
I will be doing the exact same thing for the heat portion.
Here is my button, it is working perfectly, except I can’t get it to set an off color and on color. The default colors are too similar. i want it to be that light blue when off, and white when on.
show_name: true
show_icon: true
type: button
tap_action:
action: call-service
service: script.1689247316109
data:
mode: cool
temp: 72
name: Cool
icon: mdi:snowflake
entity: climate.40681930235404_climate
show_state: true
The button turns it on and off as it should, and sets the mode and temp.
But no matter what I do, I can’t add logic to change color based on state, I keep getting an error that it is not supported or unexpected.
So I tried a custom card.
The custom card will fail when I run the script.
Whats funny is the icon DOES change color, when i activate the other button lol.
But I can’t run the script on the custom card button.
type: custom:button-card
show_name: true
show_icon: true
tap_action:
action: call-service
service: script.1689260694043
data:
mode: cool
temp: 72
name: Cool
icon: mdi:snowflake
entity: climate.40681930235404_climate
state:
- value: 'off'
color: rgb(52, 125, 235)
- value: 'on'
color: rgb(255,255,255)
When trying to use that card, here is the error from the trace:
Stopped because an error was encountered at July 13, 2023 at 12:58:17 PM (runtime: 0.01 seconds)
expected float for dictionary value @ data[‘temperature’]
(I created a duplicate of the original script for the custom button card, cause I keep getting that float error, so I would not mess up the one that is actually working.
alias: GarageAC_OnOff (Duplicate)
sequence:
- choose:
- conditions:
- condition: template
value_template: "{{ mode != states('climate.40681930235404_climate') }}"
sequence:
- service: climate.set_temperature
data_template:
temperature: "{{ temp }}"
hvac_mode: "{{ mode }}"
target:
entity_id: climate.40681930235404_climate
default:
- service: climate.turn_off
data: {}
target:
entity_id: climate.40681930235404_climate
fields:
mode:
name: Mode
example: cool
temp:
name: Temperature
example: 72
mode: single
i tried doing a pipe to float, no dice, most likely cause I am doing it wrong