milanmeu / aioaseko

Async Python package for the Aseko Pool Live API
https://pypi.org/project/aioaseko/
GNU Lesser General Public License v3.0
4 stars 2 forks source link

support of new api #8

Closed hessbe closed 2 days ago

hessbe commented 1 week ago

Hi there,

As you already probably know, Aseko launched their new cloud / apps today and the old way doesn't work anymore.

After a quick look, the data is now available via GraphQL interface and the login changed a bit. I'm not experienced with web auth so I only know that there is a token, email and passwort sent and the answer is a token.

Do you plan to update the library (and the home assistant integration) in the near future?

Lukily the summer is almost over and I currently don't really need the home assistant integration.

ervin75 commented 6 days ago

Hi there,

Experiencing the same issue from the time (yesterday) they did changes in ASEKO :( Would be great to have a working version of this useful development. Thanks

arsi-apli commented 6 days ago

I called Aseko today and their statement is that the new API is private and they don't plan to make it public. The fact that I need to display that data for my customer in the Scada system is of no interest to them.

So I started to analyze it.. But my version will be in Java. This is what I found out so far: The new API uses graphql. You can test queries at this url https://graphql.acs.prod.aseko.cloud/graphql In the bottom left click on HTTP headers and paste:

{
  "Authorization": "Bearer xxxxxx"
}

I got that xxxxxx from the network monitor in firefox so far, I need to figure out how to gets it automaticaly. It will expire after some time.. So don't forget to replace xxxxxx with your current access code.

This request returns a list of units:

fragment UnitFragment on Unit {
  __typename
  serialNumber
  name
  note
  brandName {
    id
    primary
    secondary
    __typename
  }
  position
  statusMessages {
    __typename
    type
    severity
    message
  }
  consumables {
    __typename
    ... on LiquidConsumable {
      canister {
        __typename
        id
        hasWarning
      }
      tube {
        __typename
        id
        hasWarning
      }
      __typename
    }
    ... on ElectrolyzerConsumable {
      electrode {
        __typename
        hasWarning
      }
      __typename
    }
  }
  online
  offlineFor
  hasWarning
  notificationConfiguration {
    __typename
    id
    hasWarning
  }
  unitModel {
    __typename
    id
    tabs {
      hideNotifications
      hideConsumables
      __typename
    }
  }
}

fragment UnitNeverConnectedFragment on UnitNeverConnected {
  __typename
  serialNumber
  name
  note
  position
  statusMessages {
    __typename
    severity
    type
    message
    detail
  }
}

query UnitList {
  units(after: null, first: 15, searchQuery: "") {
    cursor
    units {
      ...UnitFragment
      ...UnitNeverConnectedFragment
      __typename
    }
    __typename
  }
}
arsi-apli commented 6 days ago

Here is my working version in Java: https://github.com/arsi-apli/JAsekoV2APIDemo

hessbe commented 2 days ago

Thank you very much for implementing it so quickly