Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added zhimi.heater.mc2a model #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# homeassistant-mi-heater for zhimi.heater.mc2, zhimi.heater.zb1 and zhimi.heater.za2
# homeassistant-mi-heater for zhimi.heater.mc2, zhimi.heater.mc2a, zhimi.heater.zb1 and zhimi.heater.za2
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge)](https://github.com/custom-components/hacs)
- Modified component what was not correctly worked in HASS new version.
- Tested on zhimi.heater.mc2
- Tested on zhimi.heater.mc2 and zhimi.heater.mc2a
- Tested on zhimi.heater.zb1
- Tested on zhimi.heater.za2 (some issues reported. If someone has the correct raw codes working, I can integrate)




Xiaomi Smart Space Heater S(zhimi.heater.mc2) component for home-assistant
Xiaomi Smart Space Heater S(zhimi.heater.mc2 or zhimi.heater.mc2a) component for home-assistant
![p](https://cdn.weasy.io/users/xiaomi/catalog/mi_smart_space_heater_s.jpg)

Xiaomi Mi Smart Space Heater 1S (zhimi.heater.zb1) component for home-assistant
Expand Down Expand Up @@ -39,7 +39,7 @@ climate:
host: <your device ip address>
token: <your device miio token>
name: xiaomi_heater
model: zhimi.heater.mc2 (optional: zhimi.heater.mc2 | zhimi.heater.zb1 | zhimi.heater.za2)
model: zhimi.heater.mc2 (optional: zhimi.heater.mc2 | zhimi.heater.mc2a | zhimi.heater.zb1 | zhimi.heater.za2)
````


Expand Down
11 changes: 6 additions & 5 deletions custom_components/miheater/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
vol.Optional(CONF_DEVICE_ID): cv.string,
vol.Optional(CONF_MODEL, default=None): vol.In(
['zhimi.heater.mc2',
'zhimi.heater.mc2a',
'zhimi.heater.zb1',
'zhimi.heater.za2',
'zhimi.heater.za1', None]),
Expand Down Expand Up @@ -89,7 +90,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
async def set_room_temp(service):
"""Set room temp."""

if DEVICE_MODEL == "zhimi.heater.mc2":
if DEVICE_MODEL == "zhimi.heater.mc2" or DEVICE_MODEL == "zhimi.heater.mc2a":
aux = device.raw_command('get_properties', [{"siid":2,"piid":5,"did":DEVICE_ID}])
elif DEVICE_MODEL == "zhimi.heater.zb1" or DEVICE_MODEL == "zhimi.heater.za2":
aux = device.raw_command('get_properties', [{"siid":2,"piid":6}])
Expand Down Expand Up @@ -182,7 +183,7 @@ def getAttrData(self):
#device_info = self._device.info()
#DEVICE_MODEL = device_info.model

if self._model == "zhimi.heater.mc2":
if self._model == "zhimi.heater.mc2" or self._model == "zhimi.heater.mc2a":
power=self._device.raw_command('get_properties', [{"did":DEVICE_ID,"siid":2,"piid":1}])
target_temperature=self._device.raw_command('get_properties', [{"did":DEVICE_ID,"siid":2,"piid":5}])
current_temperature=self._device.raw_command('get_properties', [{"did":DEVICE_ID,"siid":4,"piid":7}])
Expand Down Expand Up @@ -245,7 +246,7 @@ async def async_set_temperature(self, **kwargs):
#device_info = self._device.info()
#DEVICE_MODEL = device_info.model

if self._model == "zhimi.heater.mc2":
if self._model == "zhimi.heater.mc2" or self._model == "zhimi.heater.mc2a":
self._device.raw_command('set_properties',[{"value":int(temperature),"siid":2,"piid":5, "did":DEVICE_ID}])
elif self._model == "zhimi.heater.zb1" or self._model == "zhimi.heater.za2" :
self._device.raw_command('set_properties',[{"value":int(temperature),"siid":2,"piid":6}])
Expand All @@ -260,7 +261,7 @@ async def async_turn_on(self):
#device_info = self._device.info()
#DEVICE_MODEL = device_info.model

if self._model == "zhimi.heater.mc2":
if self._model == "zhimi.heater.mc2" or self._model == "zhimi.heater.mc2a":
self._device.raw_command('set_properties',[{"value":True,"siid":2,"piid":1, "did":DEVICE_ID}])
elif self._model == "zhimi.heater.zb1" or self._model == "zhimi.heater.za2" :
self._device.raw_command('set_properties',[{"value":True,"siid":2,"piid":2}])
Expand All @@ -275,7 +276,7 @@ async def async_turn_off(self):
#device_info = self._device.info()
#DEVICE_MODEL = device_info.model

if self._model == "zhimi.heater.mc2":
if self._model == "zhimi.heater.mc2" or self._model == "zhimi.heater.mc2a":
self._device.raw_command('set_properties',[{"value":False,"siid":2,"piid":1, "did":DEVICE_ID}])
elif self._model == "zhimi.heater.zb1" or self._model == "zhimi.heater.za2" :
self._device.raw_command('set_properties',[{"value":False,"siid":2,"piid":2}])
Expand Down
4 changes: 2 additions & 2 deletions info.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Home Assistant Integration for zhimi.heaters
Modified component what was not correctly worked in HASS new version.
Tested on zhimi.heater.mc2
Tested on zhimi.heater.mc2 and zhimi.heater.mc2a
Tested on zhimi.heater.zb1
Tested on zhimi.heater.za2 (some issues reported)

Expand Down Expand Up @@ -28,7 +28,7 @@ climate:
host: <your device ip address>
token: <your device miio token>
name: xiaomi_heater
model: zhimi.heater.mc2 (optional: zhimi.heater.mc2 | zhimi.heater.zb1 | zhimi.heater.za2)
model: zhimi.heater.mc2 (optional: zhimi.heater.mc2 | zhimi.heater.mc2a | zhimi.heater.zb1 | zhimi.heater.za2)
````


Expand Down