misza
(misza)
October 12, 2018, 4:48am
1
Hello,
I can’t find how to get temperature and humidity from air purifier.
My air purifier is configured (I can turn it on and off and nothing else)
I have Xiaomi air purifier 2. (model: zhimi.airpurifier.m2)
Please help me. I can’t find any example configurations
tom_l
October 12, 2018, 4:56am
2
Telling us your air purifier make and model would help. So would the code you are currently using to control it.
nickrout
(Nick Rout)
October 12, 2018, 5:11am
3
Yep, my crystal ball is on the blink again…
poebae
October 12, 2018, 5:18am
4
Check the states ‘<> button in the dev tools’ and see which attributes show up for the air purifier in the right column.
To extract the temperature I’d use the template:
“{{ states .sensor.plug_bedroomheater_power.attributes.temperature }}”
1 Like
misza
(misza)
October 12, 2018, 5:20am
5
Sorry
I have Xiaomi air purifier 2. (model: zhimi.airpurifier.m2)
Can You paste me sample configuration of sensor?
misza
(misza)
October 12, 2018, 5:53pm
6
Now I get the error:
Invalid config for [sensor.template]: expected a dictionary for dictionary value @ data[‘sensors’]. Got None. (See ?, line ?)
My config:
sensor:
platform: template
sensors:
syp_temp:
friendly_name: temperatura B
value_template: ‘{{ state.fan.syp.attributes.temperature }}’
unit_of_measurement: “°C”
nickrout
(Nick Rout)
October 12, 2018, 7:23pm
7
Please format your code properly, see the top of the page.
misza
(misza)
October 13, 2018, 5:09am
8
My config:
sensor:
- platform: template
sensors:
syp_temp:
friendly_name: temp B
value_template: '{{ state.fan.syp.attributes.temperature }}'
unit_of_measurement: "°C"
fan:
- platform: xiaomi_miio
name: syp
host: 192.168.1.25
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
model: zhimi.airpurifier.m2
The error I get is:
Invalid config for [sensor.template]:
expected a dictionary for dictionary value @ data['sensors']. Got None. (See ?, line ?).
Please help!
1 Like
Dixey
October 13, 2018, 5:15am
9
Try states (instead of state)
1 Like
nickrout
(Nick Rout)
October 13, 2018, 5:17am
10
According to the docs you need to double quote the friendly name, and double (not single) quote the template. See
nickrout
(Nick Rout)
October 13, 2018, 5:18am
11
Also your indentation is off, the lines below sensors: need to be indented, see the same docs.
tom_l
October 13, 2018, 5:38am
12
Actually you can use single or double quotes for templates (Rule 3): Automation trigger variables - Home Assistant
nickrout
(Nick Rout)
October 13, 2018, 5:39am
13
Thanks, I must admit I was just looking at the examples…
I think my indentation point is correct though.
tom_l
October 13, 2018, 5:42am
14
It probably depends who writes the examples and their preferred style. I guess double quotes is safer - in case you have single quotes inside.
Dixey
October 13, 2018, 5:42am
15
is_state or states… there is no “state”
1 Like
tom_l
October 13, 2018, 5:45am
16
To elucidate @Dixey ’s point, this is what you should have:
value_template: ‘{{ states .fan.syp.attributes.temperature }}’
1 Like
Dixey
October 13, 2018, 5:49am
17
I was getting ready to post a snippet from my sensors.yaml to show an example and I noticed I also had sometimes used single quotes and sometimes double… depending on my mood I guess.
My lack of coding discipline is showing… I better tuck it in.
2 Likes