Code Monkey home page Code Monkey logo

py-electrolux-ocp's Introduction

py-electrolux-ocp

Python package wrapper around Electrolux OneApp (OCP) api

Early version, this package APIs might change

Prerequisites

pip install pyelectroluxocp

Usage examples

Example to connect via websockets and listen for appliance state changes

import asyncio
import json
from pyelectroluxocp import OneAppApi

async def main():
    async with OneAppApi("__username__", "__password__") as client:
        appliances = await client.get_appliances_list()

        print("appliances found: ", json.dumps([x.get("applianceData").get("applianceName")+" "+x.get("applianceId") for x in appliances]))

        def state_update_callback(a):
            print("appliance state updated", json.dumps((a)))
        await client.watch_for_appliance_state_updates([appliances[0].get("applianceId")], state_update_callback)

asyncio.run(main())

TODOs

  • Better error messages on known scenarios (login failed)

py-electrolux-ocp's People

Contributors

dfips avatar woyken avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

joosthoi1 dfips

py-electrolux-ocp's Issues

Blocking await

Hi,

since this update, the call to "watch_for_appliance_state_updates" blocks and won't return.
So the component initialization is blocked. Before the method would return immediately and the callback would be called at each message received
image

Thanks for your support

Productize this library

Ciao @Woyken,

I noticed that you've written this library, but you haven't completed the steps to make it usable.

Could you please:

  • Make the library available on PIP
  • Provide examples on how to use it?

Thank you!

Websocket stops working after a while

Hi @Woyken ,

I have another raised issue from Home assistant users : the websockets seems to stop working after a while.
I have added an automatic close/reconnection of the websocket after 12 hours (configurable) but it didn't address the problem.

  1. Normally when the websocket stops working, the server would stop answering ping/pong but there are not such errors in the logs (an exception should be raised and your websocket implementation reconnects automatically with handle_disconnected_or_connected_event ?)
  2. I thought that the server would continue to answer ping/pong but won't push data anymore, but in that case the reset of the websocket after 12 hours should unlock pushing data but this is not the case

I wonder if this is not like a throttle control on the number of requests or a kind of blacklisting of the user....
On my side I have sometimes initialization errors when I restart HA (which happens quite offtently during my devs)
I am running out of ideas

Thank you for your help
Damien

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.