Giter Club home page Giter Club logo

Comments (8)

sanjoyg avatar sanjoyg commented on June 12, 2024

I got it almost done, but would need some testing. Is the motorRunTime also a time attribute that is in "minutes" or is it something different?

from dirigera_platform.

sanjoyg avatar sanjoyg commented on June 12, 2024

Added support, do test it and let me know. This is available in the latest release

from dirigera_platform.

acces90 avatar acces90 commented on June 12, 2024

The motorRunTime is also in minutes. Its the total time the fan has worked basically. In the case of this Starkvind it would be around 518 days it's been running.

I will test the new version and report! thank you

from dirigera_platform.

acces90 avatar acces90 commented on June 12, 2024

it finds the air purifiers but the entities are not available. I believe you forgot the ".attributes", as in fan.py line 125 it should be
return self._json_data.attributes.motor_state

Logger: homeassistant.components.fan
Source: helpers/entity_platform.py:352
Integration: Lüfter ([documentation](https://www.home-assistant.io/integrations/fan), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+fan%22))
First occurred: 18:18:34 (1 occurrences)
Last logged: 18:18:34

Error while setting up dirigera_platform platform for fan
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 352, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 533, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 782, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1325, in add_to_platform_finish
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 989, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in _async_write_ha_state
    state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1047, in __async_calculate_state
    state = self._stringify_state(available)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 995, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1600, in state
    if (is_on := self.is_on) is None:
                 ^^^^^^^^^^
  File "/config/custom_components/dirigera_platform/fan.py", line 272, in is_on
    return self._device.is_on
           ^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dirigera_platform/fan.py", line 178, in is_on
    if self.available and self.motor_state > 0:
                          ^^^^^^^^^^^^^^^^
  File "/config/custom_components/dirigera_platform/fan.py", line 125, in motor_state
    return self._json_data.motor_state
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'AirPurifier' object has no attribute 'motor_state'. Did you mean: 'set_motor_state'?

from dirigera_platform.

acces90 avatar acces90 commented on June 12, 2024

I made a fork and fixed some stuff in fan.py (attributes, and icons). Everything seems to work just fine now! thank you for your work <3

Bildschirmfoto 2024-02-28 um 22 35 37

we can either merge or you just copy paste the few edits from my fork.

the only thing I don't get is why every entity act's like a switch when clicked?
Bildschirmfoto 2024-02-28 um 22 12 52

from dirigera_platform.

sanjoyg avatar sanjoyg commented on June 12, 2024

Thank you, you should have just submitted a pull request. I copied your code and pushed a new release.

Not sure why when its clicked shows a switch.

from dirigera_platform.

BeauGiles avatar BeauGiles commented on June 12, 2024

Hi,
I can't manage to get the JSON dump (nothing appears in the logs after calling the service???) but my air purifier isn't showing in HA.

From the error log

Error while setting up dirigera_platform platform for fan Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 350, in _async_setup_platform await asyncio.shield(awaitable) File "/config/custom_components/dirigera_platform/fan.py", line 48, in async_setup_entry hub_air_purifiers = await hass.async_add_executor_job(hub.get_air_purifiers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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/dirigera/hub/hub.py", line 129, in get_air_purifiers return [dict_to_air_purifier(air_p, self) for air_p in airpurifiers] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dirigera/devices/air_purifier.py", line 77, in dict_to_air_purifier return AirPurifier( ^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pydantic/main.py", line 341, in __init__ raise validation_error pydantic.error_wrappers.ValidationError: 1 validation error for AirPurifier attributes -> fanMode value is not a valid enumeration member; permitted: 'low', 'medium', 'high', 'auto' (type=type_error.enum; enum_values=[<FanModeEnum.LOW: 'low'>, <FanModeEnum.MEDIUM: 'medium'>, <FanModeEnum.HIGH: 'high'>, <FanModeEnum.AUTO: 'auto'>])

Error adding entity None for domain sensor with platform dirigera_platform Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 576, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 725, in _async_add_entity device = dev_reg.async_get(self.hass).async_get_or_create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: homeassistant.helpers.device_registry.DeviceRegistry.async_get_or_create() argument after ** must be a mapping, not SensorDeviceClass

Check out this STARKVIND from IKEA.
Here’s a little more information:
https://ingka.page.link/Mn5pCyvc17aTX8ML8

from dirigera_platform.

sanjoyg avatar sanjoyg commented on June 12, 2024

from dirigera_platform.

Related Issues (20)

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.