I can see now that is seems to be complaining about your token.
Are you sure that is correct?
Can you share your configuration but changing some characters of token to keep anonymity?
Oh… I just noticed that I have an za2, and not a zb1…
It is just like the picture from the zb1 so I didn’t even reflect… I went to extract the tokens again to make sure it was correct, and noticed the “MODEL: zhimi.heater.za2”, don’t know if it could be the problem.
I have updated the “model” in the code, but it still gives me the same error.
My code is this (with changed token)
climate:
- platform: miheater
host: 192.168.50.166
token: ff01b41b24cb953bccd633653b952cc0A
name: xiaomi_heater
model: zhimi.heater.za2
This is on server “DE”, if it helps in any way
The error is really strange. Is there anyway you can check that you have the correct token? It should be an hexadecimal string, and the error is saying it’s not.
Please confirm it only contains numbers and lowercase “a” to “f”.
Hi Sergio,
For some reason, this morning it started working. Maybe it still had something in the cache…
Either way, it works perfectly
Thanks for all the help and patience
Hello @sergio_pt!
First of all, thanks a lot for your contribution, i have on of these heaters, and the integration is working so far!
Just some questions I got:
- How did you get those sensors for your card? sensor.thermostat_temperature, sensor.thermostat_setting & sensor.xiaomi_heater_switch? Are those template sensors? Can you share them?
- When I was configuring the integration, I first installed the repository into HACS, and restarted my HA instance before changing my config file, and HACS didn’t even boot up properly. After that, I completed the configuration, and after restarting, HACS was ok. Maybe this has something to do with a hang on the custom component?
- My climate entity shows this warning/error:
This entity ("climate.zhimi_heater_mc2_64_90_c1_93_8f_02") does not have a unique ID, therefore its settings cannot be managed from the UI. See the [documentation](https://www.home-assistant.io/faq/unique_id) for more detail.
Any idea? I can’t also change the entity id/name.
To finish up, I am not a very experienced Python developer, but I am professionally an SW developer, so if you need any help developing new features, fixing stuff or refactoring, let me know!
Cheers from Braga!
Hi Carlos,
Let me breakdown my answer and apologies for the delay, but I just got back to PC from the holidays
Regarding the sensors for my card, I have used the below templates:
- platform: template
sensors:
heater_switch:
friendly_name: "Heater Switch"
value_template: >-
{% if is_state('switch.plug_heater', 'off') %}
0
{% elif is_state('switch.plug_heater', 'on') %}
1
{% endif %}
xiaomi_heater_switch:
friendly_name: "Xiaomi Heater Switch"
value_template: >-
{% if is_state('climate.zhimi_heater_mc2_5c_e5_0c_e0_1a_f7', 'heat') %}
{{ state_attr('climate.zhimi_heater_mc2_5c_e5_0c_e0_1a_f7', 'current_temperature') }}
{% elif is_state('climate.zhimi_heater_mc2_5c_e5_0c_e0_1a_f7', 'off') %}
0
{% endif %}
The second point you mention, is something that didn’t happen to me, there should be no issue in having an integration without a configuration, it would just mean that the instance does to instantiate it. But I really don’t know
Regarding the third point, that warning happens because this integration is not using default Home Assistant integration configuration (it is still using yaml to initiate and get the token, versus configuring in “integrations”)
For the final point, this was my first python experience and I haven’t programmed in quite a few years now, so, if you want to check the code and fix it or add more functionalities, I would very much welcome it. I believe the repository is public and you can make PRs.
Cheers from Lisbon!
Hello Sergio!
No problem, don’t apologize for that
Thanks for sharing, i tweaked it up a bit, but i get the point!
Blockquote
The second point you mention, is something that didn’t happen to me, there should be no issue in having an integration without a configuration, it would just mean that the instance does to instantiate it. But I really don’t know
Yes, probably something related to HACS or smtg.
Blockquote
Regarding the third point, that warning happens because this integration is not using default Home Assistant integration configuration (it is still using yaml to initiate and get the token, versus configuring in “integrations”)
Ah ok, no problem then.
Blockquote
For the final point, this was my first python experience and I haven’t programmed in quite a few years now, so, if you want to check the code and fix it or add more functionalities, I would very much welcome it. I believe the repository is public and you can make PRs.
Yes, the repo is public! Probably trying to put the configuration via UI, instead of YAML, would be a nice improvement. In the coming week, i’ll setup the development environment and try to play with it a bit.
Thanks a lot!
Hi!
I just discovered this heater “Xiaomi Smart Heater 1S” and I am considering buying a couple of them if they can integrate to Home Assistant (Which it seems they can thanks to your work - awesome, thanks!).
However I was wondering if it is possible to regulate the wattage on this heater? It seems like it is only possible to regulate the temperature? (Either with the integration or native app, or even the touch screen).
Let’s say I wanted to run it at just 1000W or something like that, is it possible?
Thanks.
Hi!
It’s not possible to regulate the power. Not even from the Xiaomi app.
It is something it does internally based on it’s temperature sensor. I really wish we could do it, as I find its internal temperature sensor unreliable.
Hey, thanks a lot for clarifying.
That is a shame, as most normal heaters usually have at least 2-3 power settings.
But that is what I feared while looking at the details and specifications.
2200W is basically a whole 10A circuit, so it would be nice to have some control over it.
I might have to reconsider, or maybe just buy 1 instead of 2 as I first planned.
Are you happy with it besides this?
I am really happy.
Yesterday was a really cold day here (Lisbon), so for the fist time I left it with the setting for 28C and it kept my livingroom above 23C (constant) which was really nice.
In the morning, I use an automation to heat the bedroom to 20C and it does the job very nicelly.
(this was my reason to buy it, it doesn’t dry the air as much as other heaters).
@sergio_pt, I would really like to thank you for the great work you did here.
I’m starting to play with Home Assistant and was looking for integrating my Xiaomi Smart Heater S, and luckily I found this thread!
Off-topic: earlier you mentioned that the
I was also looking to buy a smart plug (with power usage data) that I could easily integrate with HA. Could you please share which one you use since that is obviously confirmed to work fine?
Hi!
Thank you for your words.
I have a few different plugs flashed with Tasmota.
The one I’m using with the heater is:
https://www.blitzwolf.com/3840W-EU-WIFI-Smart-Socket-p-244.html
Thanks for the reply, @sergio_pt.
3840 W (16 A) - that is exactly what I was looking for.
But apparently, I will need to add that “Tasmota flashing” to my learning stack (besides HA, etc…).
In my laziness, I was expecting to find some smart plug that I could “plug-an-play” to HA
I understand what you are saying. But it was really easy!
Just follow this guide:
No cables or soldering, just software
Hmmm, “just software” - you convinced me
Here I go buy me a plug.
Hehehehe
Believe me
I’m not a developer. I just like technology and with these helpfull communities everything is doable. Hehehehe
Dear Sergio,
I am planning to buy this heater and i am very thankfull that you made this!! Can you please describe in the documentation how to extract the token? With my xiaomi robo vacuum it was a huge pain until i found a small cmd prompt program that just extracted it from out of my account.
Many thanks again. I love the HA community. everyone is helping!
I would also like to know what knowledge you need to being able to write stuff myself. So where do i start to make a custom integration myself? Is there some sort of tutorial on how to start?
It would be great to contribute to the community in the future.
Hi @sygys,
I believe you may have used the same tool in the past as I’m using now.
This is the easiest way to extract the token:
Regarding the integration first steps, I followed this guide:
But after that, there is nothing better than looking at other existing integrations and building up from there
super! many thanks for sharing this.