wuwentao / midea_ac_lan

Auto-configure and then control your Midea M-Smart devices (Air conditioner, Fan, Water heater, Washer, etc) via local area network.
MIT License
101 stars 5 forks source link

Cannot access on climate entities throght template or python script #189

Closed Rihan9 closed 1 day ago

Rihan9 commented 3 days ago

HA core version

2024.6.4

Integration version

v0.4.2

Device type and model

Air Conditioner 00000Q1B (0)

Used App

Carrier air conditioner

The description of problem

Hi, to prevent an automation to turn on and off the climate continuously, I need to access the last_changed attribute throght this:

states.climate.153931628036068_climate.last_changed

but neiter in template nor in python script the command works. I got the following error: expected token 'end of print statement', got '_climate'

I tried the same command with a generic light and works. Can you please help me?

Thanks and Regards

The logs

No response

chemelli74 commented 2 days ago

Please try with the following syntax:

{{ states('climate.142936511746774_climate')['last_changed'] }}
Rihan9 commented 1 day ago

Hi @chemelli74 , same error

Rihan9 commented 1 day ago

Hi, I tried to rename the entity name from "142936511746774_climate" to "142936511746774", and now the states.climate.153931628036068_climate.last_changed works

Rihan9 commented 1 day ago

Hi, I also managed to make it works in the python scripts, without change the name of the entity, so I'm good now. Thanks for your help!