tsunglung / XiaomiAirFryer

Xiaomi Smart Air Fryer integration for Home Assistant
MIT License
65 stars 18 forks source link

Set Target temperature & Set Target time services - Allow Helpers #5

Open Biscotte31 opened 2 years ago

Biscotte31 commented 2 years ago

Hello,

Here is a missing feature in this integration, concerning both Set Target time and Set Target temperature services.

For both target_time and target_temperature, simple numbers directly written in the automation are allowed. But I can't put any helper instead of it, even an imput_number helper.

In other words : This works `sequence:

target_temperature: 200`

But that does not: `sequence:

target_temperature: input_number.friteuse_temperature`

We should be able to set up these values directly from Home Assistant UI. This is annoying to go in the automation itself to update them.

boyocska65 commented 1 year ago

How can I set the temperature and time from HA?

Axydas commented 1 year ago

Good suggestion. I was trying to do the same without success

tangrasmus commented 6 months ago

I am trying to use template but when i save this:

type: custom:mushroom-number-card entity: input_number.mia_temp tap_action: action: call-service service: xiaomi_airfryer.target_temperature target: {} data: target_temperature: {{ states('input_number.mia_temp') | int }} entity_id: switch.xiaomi_airfryer_careli_fryer_maf05a icon_color: red

And if I go in to edit again this was saved:

type: custom:mushroom-number-card entity: input_number.mia_temp tap_action: action: call-service service: xiaomi_airfryer.target_temperature target: {} data: target_temperature: '[object Object]': null entity_id: switch.xiaomi_airfryer_careli_fryer_maf05a icon_color: red

in HAS template developer tool this gives the correct value: {{ states('input_number.mia_temp') | int }}

What am I doing wrong ,please help me here

danielgoz commented 6 months ago

The way it is working for me. create 2 number helpers (1 for temp, 1 for time) create a script to set temp/time as per helpers and to start the air frier alias: Airfrier.set sequence:

OBS: needs to be done in yaml (not working in UI)

now creatre a buttom to run the script tap action: call service service: script: turn on point to the entity related to your script

it will set temp and time as per current values of helper and start the frier.

Hope that helps

tangrasmus commented 6 months ago

Thanks wery much, it works with small changes in objects and after indention of "data" sections as below. I also putted the conversion to "INT" in the templates. NB!! the problem is here on Github when you save a comment the indention is removed airfryer_set: alias: AirfyerSet sequence:

boyocska65 commented 6 months ago

Megcsináltam a segéd identitásokat, meg a scriptet, de nem tudom hogyan tovább... segítesz?