Giter Club home page Giter Club logo

switchbot-client's People

Contributors

dependabot[bot] avatar kzosabe avatar

Stargazers

 avatar  avatar  avatar  avatar

Forkers

chanyou0311

switchbot-client's Issues

Add methods to manipulate a single value

air_conditioner.set_all(
    temperature=25,
    mode=AirConditioner.Parameters.MODE_DRY,
    fan_speed=AirConditioner.Parameters.FAN_SPEED_AUTO,
    power=AirConditioner.Parameters.POWER_ON
)

to

air_conditioner.set_temperature(25)
air_conditioner.set_mode(AirConditioner.Parameters.MODE_DRY)
  • generate methods get state and set single value
  • store current state in object (if needed, or use builder-pattern)

Get all devices from api as object interface

  • Add SwitchBotClient class as wrapper of SwitchBotAPIClient
  • Add SwitchBotClient#get_devices
    • call SwitchBotAPIClient#devices
    • merge deviceList and infraredRemoteList
    • generate SwitchBotDevice and SwitchBotRemoteDevice instance
    • returns list contains these instances

Cannot handle meter plus device type

Hello @kzosabe and thank you very much for open-sourcing this library. I would like to use it to read the current temperature and humidity of my Meter Plus devices but it always throws an error as soon as I call the SwitchBotClient.devices method. The error is a TypeError with the message invalid physical device object.

Looking through the source, I see that you instantiate the device objects based on the deviceType which is MeterPlus in my case. Your DeviceType does not have this value but a Meter Plus (US) and a Meter Plus (JP). Just changing one of the Enum values to MeterPlus makes it work perfectly.

Looking at the Meter Plus devices section in the SwitchBot API docs it seems to me that the current values Meter Plus (US) and Meter Plus (JP) are simply incorrect and you only need the MeterPlus type like with Meter, no separate MeterPlusUs and MeterPlusJp

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.