Giter Site home page Giter Site logo

homeassistant-xiaomi-ng's Introduction

Hello! Hallo! Moi! ๐Ÿ‘‹

I am Teemu from ๐Ÿ‡ซ๐Ÿ‡ฎ, and I'm currently living in ๐Ÿ‡ฉ๐Ÿ‡ช, happy to see you here!

On this profile page, I present you some (automatically generated) information about my public contributions here on GitHub, mostly on projects useful for home automation.

According to GitHub, I have submitted 148 issues, 1,105 pull requests, and also written 5,160 issue comments here since 2013. Since then, my projects have been honored with a total of 5,283 โญ and 959 ๐Ÿด. I am happy if you have found my software, code reviews, help, or feedback useful! ๐Ÿฅฐ

Most of my Python projects are also available on the Python Package Index, which according to the PyPI Stats have been downloaded 785,233 times over the past month.

My projects

GitHub says that I am currently a maintainer or a collaborator in the following projects:

  1. rytilahti/python-miio โ€“ Python library & console tool for controlling Xiaomi smart appliances (3,431 โญ, 535 ๐Ÿด)
  2. python-kasa/python-kasa โ€“ ๐Ÿ ๐Ÿค– Python API for TP-Link smarthome products (1,119 โญ, 188 ๐Ÿด)
  3. GadgetReactor/pyHS100 โ€“ Python Library to control TPLink Switch (HS100 / HS110) (406 โญ, 128 ๐Ÿด)
  4. rytilahti/python-eq3bt โ€“ Python library and command-line tool for eQ-3 Smart Bluetooth thermostats (114 โญ, 36 ๐Ÿด)
  5. rytilahti/python-yeelightbt โ€“ Python library for Yeelight's bedside (btle) and candela lamps (84 โญ, 26 ๐Ÿด)
Show more

  1. rytilahti/python-songpal โ€“ Python library for interfacing with Sony's Songpal devices (62 โญ, 24 ๐Ÿด)
  2. rytilahti/homeassistant-mpris-bridge โ€“ Control your Home Assistant media players from your desktop using MPRIS (21 โญ, 1 ๐Ÿด)
  3. rytilahti/homeassistant-upnp-availability โ€“ UPnP Availability sensor for Home Assistant (20 โญ, 6 ๐Ÿด)
  4. rytilahti/python-ubus โ€“ Python library for accessing ubus over JSON-RPC (16 โญ, 9 ๐Ÿด)
  5. DNS-OARC/ripe-hackathon-dns-caching โ€“ Everything you ever wanted to know about caching resolvers but were afraid to ask (4 โญ, 2 ๐Ÿด)
  6. rytilahti/python-nucled โ€“ Python interface for intel_nuc_led kernel driver (3 โญ, 1 ๐Ÿด)
  7. rytilahti/mqtt-bridge โ€“ "mqtt-bridge" -- execute shell commands on incoming MQTT messages (1 โญ, 0 ๐Ÿด)
  8. rytilahti/homeassistant-xiaomi-ng โ€“ None (1 โญ, 2 ๐Ÿด)
  9. RUB-SysSec/TurnkeyVPNStudy โ€“ None (0 โญ, 1 ๐Ÿด)

Recent contributions

In the past 371 days (since 03 June, 2023), I have submitted 243 pull requests on 15 different repositories, including:

Show more

Code Reviews

Besides contributing pull requests, I also try to help others by doing code reviews. During the previously mentioned time period, I have submitted 301 reviews to pull requests on 15 different repositories, including:

Show more

(Generated on 09 June, 2024)

homeassistant-xiaomi-ng's People

Contributors

rytilahti avatar slaks avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

slaks

homeassistant-xiaomi-ng's Issues

Roborock: Add additional entities

HA's native roborock integration has some configuration options that this does not:
image

This includes Time entities.

I personally do not currently need these and do not plan to contribute them, but other people might be interested.

Make entities conditional

Different Roborock vacuums support different sets of entities (eg, no mop, or no mop autowash).

We should figure out some way to only create entities for features that the particular model actually supports.

Xiaomi Air Purifier 4: error spam in home assistant logs

Xiaomi Air Purifier 4 (zhimi.airp.mb5a) was connected using this ng integration with "Use generic miot implementation" enabled (without it, it fails configuration with WARNING (SyncWorker_24) [miio.device] 'AirPurifierMiot' does not specify any descriptors, please considering creating a PR. in logs, and I do expect that)

most of created entities of the device work fine, however, there is error spam in logs, every 15 seconds.

2024-04-09 17:55:31.593 ERROR (MainThread) [custom_components.xiaomi_miio.entity] Unable to find 'device_display_unit_temperature_display_unit' from ['53xxxxxxx, '__class__', '__cli_output__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_data', '_data_by_normalized_name', '_data_by_siid_piid', '_descriptors', '_dev', '_embedded', '_initialize_data', '_model', '_normalize_name', '_parent', 'air_purifier_anion', 'air_purifier_fan_level', 'air_purifier_fault', 'air_purifier_mode', 'air_purifier_on', 'alarm_alarm', 'aqi_aqi_state', 'aqi_aqi_updata_heartbeat', 'aqi_average_aqi', 'aqi_purify_volume', 'custom_service_buttom_door', 'custom_service_country_code', 'custom_service_favorite_level', 'custom_service_favorite_speed', 'custom_service_iic_error_count', 'custom_service_manual_level', 'custom_service_moto_speed_rpm', 'custom_service_motor_set_speed', 'custom_service_reboot_cause', 'data', 'descriptors', 'device', 'embed', 'environment_pm2.5_density', 'environment_relative_humidity', 'environment_temperature', 'filter_filter_left_time', 'filter_filter_life_level', 'filter_filter_used_time', 'property_dict', 'rfid_rfid_factory_id', 'rfid_rfid_product_id', 'rfid_rfid_serial_num', 'rfid_rfid_tag', 'rfid_rfid_time', 'screen_brightness'], this is a bug
2024-04-09 17:55:31.593 ERROR (MainThread) [custom_components.xiaomi_miio.entity] Unable to find 'physical_controls_locked_physical_controls_locked' from ['53xxxxxxx', '__class__', '__cli_output__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattr__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_data', '_data_by_normalized_name', '_data_by_siid_piid', '_descriptors', '_dev', '_embedded', '_initialize_data', '_model', '_normalize_name', '_parent', 'air_purifier_anion', 'air_purifier_fan_level', 'air_purifier_fault', 'air_purifier_mode', 'air_purifier_on', 'alarm_alarm', 'aqi_aqi_state', 'aqi_aqi_updata_heartbeat', 'aqi_average_aqi', 'aqi_purify_volume', 'custom_service_buttom_door', 'custom_service_country_code', 'custom_service_favorite_level', 'custom_service_favorite_speed', 'custom_service_iic_error_count', 'custom_service_manual_level', 'custom_service_moto_speed_rpm', 'custom_service_motor_set_speed', 'custom_service_reboot_cause', 'data', 'descriptors', 'device', 'embed', 'environment_pm2.5_density', 'environment_relative_humidity', 'environment_temperature', 'filter_filter_left_time', 'filter_filter_life_level', 'filter_filter_used_time', 'property_dict', 'rfid_rfid_factory_id', 'rfid_rfid_product_id', 'rfid_rfid_serial_num', 'rfid_rfid_tag', 'rfid_rfid_time', 'screen_brightness'], this is a bug

'53xxxxxxx' is what I assume some kind of device identifier, and to be safe to not give away serial number I removed digits.

Home assistant version: Container 2024.4.2

Roborock Vacuum Issues

I have an S7 (has auto empty and mop) and a Q Revo (also has water tank in base and dryer).

I tried this integration on my dev copy of HA with rytilahti/python-miio#1914.

However, the set of entities is completely wrong.

  • Each device shows the same set of 8 buttons, even though the S7 cannot wash or dry the mop (clicking those shows an error in the logs)
    image
  • Both vacuums show a status of Unknown
  • There are no sensors at all (for timing, errors, etc), unlike the current integration

How can I help fix these issues? I took a quick look at the code, but I'm not sure how the descriptors work.

I see the following log entries (each entry appears separate for each vacuum):

2024-03-17 16:42:39.970 ERROR (MainThread) [custom_components.xiaomi.device] Unable to find descriptor 'vacuum:status' for <RoborockVacuum: [elided]>
2024-03-17 16:42:39.970 ERROR (MainThread) [custom_components.xiaomi.device] Unable to find descriptor 'vacuum:mode' for <RoborockVacuum: [elided]>
2024-03-17 16:42:39.970 ERROR (MainThread) [custom_components.xiaomi.device] Unable to find descriptor 'battery:level' for <RoborockVacuum: [elided]>

Is there a way to specify which devices support an @action?

Xiaomi Air Purifier 4: cannot change entities starting with `select.`

Xiaomi Air Purifier 4 (zhimi.airp.mb5a) was connected using this ng integration with "Use generic miot implementation" enabled (without it, it fails configuration with WARNING (SyncWorker_24) [miio.device] 'AirPurifierMiot' does not specify any descriptors, please considering creating a PR. in logs, and I do expect that)

When trying to change any entity with id starting with select. (in the log below I tried to change fan level of mode manual) it fails with following error in logs:

2024-04-09 18:00:46.393 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140575151305664] Object of type Fan Level is not JSON serializable
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 195, in async_handle_select_option
    await self.async_select_option(option)
  File "/config/custom_components/xiaomi_miio/select.py", line 75, in async_select_option
    if await self._try_command(
       ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/xiaomi_miio/entity.py", line 85, in _try_command
    result = await self.hass.async_add_executor_job(full_func)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/click_common.py", line 186, in _wrap
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/miot_device.py", line 172, in set_property_by
    return self.send(
           ^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 98, in send
    return self._protocol.send(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 181, in send
    m = Message.build(msg, token=self.token)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 336, in build
    self.build_stream(obj, stream, **contextkw)
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 348, in build_stream
    self._build(obj, stream, context, "(building)")
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 2144, in _build
    buildret = sc._build(subobj, stream, context, path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 2657, in _build
    return self.subcon._build(obj, stream, context, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 4304, in _build
    buildret = self.subcon._build(obj, stream, context, path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 4616, in _build
    buildret = self.subcon._build(value, stream, context, path)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 707, in _build
    obj2 = self._encode(obj, context, path)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/protocol.py", line 160, in _encode
    json.dumps(obj).encode("utf-8") + b"\x00", context["_"]["token"]
    ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/encoder.py", line 200, in encode
    chunks = self.iterencode(o, _one_shot=True)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/encoder.py", line 258, in iterencode
    return _iterencode(o, 0)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/encoder.py", line 180, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Fan Level is not JSON serializable

Home assistant version: Container 2024.4.2

JSON Serialization Errors

2024-03-19 10:48:48.834 ERROR (SyncWorker_3) [homeassistant.helpers.json] Failed to serialize to JSON: /home/slaks/dev/home-assistant-core/config/.storage/core.entity_registry. Bad data at $.data.entities[125].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.spot_auto_dust_collection=on>>(<class 'method'>, $.data.entities[132].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.lift_auto_dust_collection=on>>(<class 'method'>, $.data.entities[133].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.lift_mop_dryer_enabled=on>>(<class 'method'>
2024-03-19 10:48:48.835 ERROR (MainThread) [homeassistant.helpers.storage] Error writing config for core.entity_registry: Failed to serialize to JSON: /home/slaks/dev/home-assistant-core/config/.storage/core.entity_registry. Bad data at $.data.entities[125].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.spot_auto_dust_collection=on>>(<class 'method'>, $.data.entities[132].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.lift_auto_dust_collection=on>>(<class 'method'>, $.data.entities[133].original_device_class=<bound method XiaomiSwitch.device_class of <entity switch.lift_mop_dryer_enabled=on>>(<class 'method'>

Roborock Vacuums have None suffix

HA sees entities vacuum.spot_none and vacuum.lift_none, which should be spot and lift.

image

I don't remember when this started happening.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.