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

leshow.heater.bs1 support #4

Open
mouth4war opened this issue Jan 27, 2020 · 14 comments
Open

leshow.heater.bs1 support #4

mouth4war opened this issue Jan 27, 2020 · 14 comments

Comments

@mouth4war
Copy link

I get an error when trying to use with leshow.heater.bs1.

@gaussian8 would appreciate your help a lot. TIA!

[custom_components.miheater.climate] Initializing Xiaomi heaters with host 192.168.31.109 (token 23aec...)
2020-01-27 15:21:02 INFO (SyncWorker_1) [custom_components.miheater.climate] leshow.heater.bs1 2.0.4 esp8266 detected
2020-01-27 15:21:05 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 419, in _async_add_entity
    await entity.async_update_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 284, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 327, in _async_write_ha_state
    attr.update(self.state_attributes or {})
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 215, in state_attributes
    self.precision,
  File "/usr/src/homeassistant/homeassistant/helpers/temperature.py", line 23, in display_temp
    raise TypeError(f"Temperature is not a number: {temperature}")
TypeError: Temperature is not a number: error
@mouth4war
Copy link
Author

mouth4war commented Jan 27, 2020

params are power for power mode, temps for target temperature, watts for power load setting (1 is 900w, 2 is 1300W , 3 is 2200w, 4 is auto), delay and sleep, sound (boolean for buzzer), lock (boolean for child lock/physical controls lock).

the three params i'm not sure about are max tempi and tempp (0, 22 and 34/35).

@mouth4war
Copy link
Author

{"id":9835,"method":"get_prop","params":["power","temps","watts","delay","sleep","sound","lock","max","tempi","tempp"]} {"code":0,"id":9835,"otlocalts":1580127392867239,"result":[1,19,1,0,1,0,0,0,22,35]}

@mouth4war
Copy link
Author

If I had to guess, I'd say tempi is environment temperature and tempp is heater temperature.

{
   "type":"urn:miot-spec-v2:device:heater:0000A01A:leshow-bs1:1",
   "description":"Heater",
   "services":[
      {
         "iid":1,
         "type":"urn:miot-spec-v2:service:device-information:00007801:leshow-bs1:1",
         "description":"Device Information",
         "properties":[
            {
               "iid":1,
               "type":"urn:miot-spec-v2:property:manufacturer:00000001:leshow-bs1:1",
               "description":"Device Manufacturer",
               "format":"string",
               "access":[
                  "read"
               ]
            },
            {
               "iid":2,
               "type":"urn:miot-spec-v2:property:model:00000002:leshow-bs1:1",
               "description":"Device Model",
               "format":"string",
               "access":[
                  "read"
               ]
            },
            {
               "iid":3,
               "type":"urn:miot-spec-v2:property:serial-number:00000003:leshow-bs1:1",
               "description":"Device Serial Number",
               "format":"string",
               "access":[
                  "read"
               ]
            },
            {
               "iid":4,
               "type":"urn:miot-spec-v2:property:firmware-revision:00000005:leshow-bs1:1",
               "description":"Current Firmware Version",
               "format":"string",
               "access":[
                  "read"
               ]
            }
         ]
      },
      {
         "iid":2,
         "type":"urn:miot-spec-v2:service:heater:0000782E:leshow-bs1:1",
         "description":"Heater",
         "properties":[
            {
               "iid":1,
               "type":"urn:miot-spec-v2:property:on:00000006:leshow-bs1:1",
               "description":"Switch Status",
               "format":"bool",
               "access":[
                  "read",
                  "write",
                  "notify"
               ]
            },
            {
               "iid":2,
               "type":"urn:miot-spec-v2:property:mode:00000008:leshow-bs1:1",
               "description":"Mode",
               "format":"uint8",
               "access":[
                  "read",
                  "write",
                  "notify"
               ],
               "unit":"none",
               "value-list":[
                  {
                     "value":0,
                     "description":"Normal"
                  },
                  {
                     "value":1,
                     "description":"Sleep"
                  }
               ]
            },
            {
               "iid":3,
               "type":"urn:miot-spec-v2:property:target-temperature:00000021:leshow-bs1:1",
               "description":"Target Temperature",
               "format":"uint8",
               "access":[
                  "read",
                  "write",
                  "notify"
               ],
               "unit":"celsius",
               "value-range":[
                  18,
                  28,
                  1
               ]
            },
            {
               "iid":4,
               "type":"urn:miot-spec-v2:property:temperature:00000020:leshow-bs1:1",
               "description":"Temperature",
               "format":"int16",
               "access":[
                  "read",
                  "notify"
               ],
               "unit":"celsius",
               "value-range":[
                  -100,
                  200,
                  1
               ]
            },
            {
               "iid":5,
               "type":"urn:miot-spec-v2:property:heat-level:00000047:leshow-bs1:1",
               "description":"Heat Level",
               "format":"uint8",
               "access":[
                  "read",
                  "write",
                  "notify"
               ],
               "unit":"none",
               "value-list":[
                  {
                     "value":1,
                     "description":"Low"
                  },
                  {
                     "value":2,
                     "description":"Middle"
                  },
                  {
                     "value":3,
                     "description":"High"
                  },
                  {
                     "value":4,
                     "description":"Auto"
                  }
               ]
            }
         ]
      },
      {
         "iid":3,
         "type":"urn:miot-spec-v2:service:countdown:0000782D:leshow-bs1:1",
         "description":"Countdown",
         "properties":[
            {
               "iid":1,
               "type":"urn:miot-spec-v2:property:countdown-time:00000055:leshow-bs1:1",
               "description":"Countdown Time",
               "format":"uint8",
               "access":[
                  "read",
                  "write",
                  "notify"
               ],
               "unit":"hours",
               "value-range":[
                  0,
                  12,
                  1
               ]
            }
         ]
      },
      {
         "iid":4,
         "type":"urn:miot-spec-v2:service:environment:0000780A:leshow-bs1:1",
         "description":"Environment",
         "properties":[
            {
               "iid":7,
               "type":"urn:miot-spec-v2:property:temperature:00000020:leshow-bs1:1",
               "description":"Temperature",
               "format":"int16",
               "access":[
                  "read",
                  "notify"
               ],
               "unit":"celsius",
               "value-range":[
                  -100,
                  200,
                  1
               ]
            }
         ]
      },
      {
         "iid":5,
         "type":"urn:miot-spec-v2:service:physical-controls-locked:00007807:leshow-bs1:1",
         "description":"Physical Control Locked",
         "properties":[
            {
               "iid":1,
               "type":"urn:miot-spec-v2:property:physical-controls-locked:0000001D:leshow-bs1:1",
               "description":"Physical Control Locked",
               "format":"bool",
               "access":[
                  "read",
                  "write",
                  "notify"
               ]
            }
         ]
      },
      {
         "iid":6,
         "type":"urn:miot-spec-v2:service:alarm:00007804:leshow-bs1:1",
         "description":"Alarm",
         "properties":[
            {
               "iid":1,
               "type":"urn:miot-spec-v2:property:alarm:00000012:leshow-bs1:1",
               "description":"Alarm",
               "format":"bool",
               "access":[
                  "read",
                  "write",
                  "notify"
               ]
            }
         ]
      }
   ]
}

@mouth4war
Copy link
Author

I have a locally tested version that works! It sets temperature and turns on/off the heater.

Still haven't mapped power modes (low, med, high, auto). Thinking of mapping to either preset modes (eco, comfort, boost, home) or to fan modes (1:1 mapping).

Any suggestions?

@gaussian8
Copy link

I searched about leshow.heater.bs1 device but I didn't found any information about that device model.
Is it based on miot platform?
Is this source code work well on miot platform?
I think power modes should be mapped to fan modes.

@mouth4war
Copy link
Author

Yeah your code works for this heater with some changes to the parameters. Some bug with the heat/off state reporting that needs fixing but other than that, it works. Does your heater state work fine?

@gaussian8
Copy link

yes. My heater device is zhimi.heater.za1 and it works well. I can set target temperature and power on/off.

@mouth4war
Copy link
Author

Don't know about your heater but mine has a useless room temperature sensor. I'm thinking these heaters are better used in HA as switches that can be combined with external temperature sensor for a generic thermostat. What do you think?

@mouth4war
Copy link
Author

I've fixed the power and HVAC state reporting bug (this uses 0/1 instead of off/on).

Will make a PR if requested. Right now, I'm trying to figure out a way to get accurate room temperature reading.

@yangshik
Copy link

yangshik commented Aug 6, 2020

Wow, this is what I was looking for. I have the same device and would like to know the progress. Thank you, mouth4war!

@mouth4war
Copy link
Author

I found the files and can make a fork. Still haven't added power modes. Do you still need it?

@yangshik
Copy link

Yes, please!

@mouth4war
Copy link
Author

@youngpiomonkey
Copy link

Try this https://github.com/mouth4war/homeassistant-mi-heater

hi,i trying to use with leshow.heater.bs1s but it get same error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants