Get indoor temperature from your LG AC WIFI

  • Install the pythinqconnect package
 pip3 install git+https://github.com/thinq-connect/pythinqconnect.git --break-system-packages
  • Get PAT token generated
https://connect-pat.lgthinq.com/tokens
  • Get Device id
import asyncio
from aiohttp import ClientSession
# Assuming a library structure like pythinqconnect
from thinqconnect.thinq_api import ThinQApi 

############## Get device ID ###############
async def test_devices_list():
    # Setup your credentials and personal access token (PAT)
    async with ClientSession() as session:
        thinq_api = ThinQApi(
            session=session, 
            access_token='PAT',
            country_code='',  # Example: US, KR, NL
            client_id='your_client_id'
        )
        # Fetch device list
        response = await thinq_api.async_get_device_list()
        print("device_list : %s", response)

# Run the async function
asyncio.run(test_devices_list())
  • Get temp
async def get_indoor_temperature_c():
    async with ClientSession() as session:
        api = ThinQApi(
            session=session,
            access_token="PAT",
            country_code="",
            client_id="YOUR_CLIENT_ID"
        )

        status = await api.async_get_device_status(DEVICE_ID)

        temp_c = status["temperature"]["currentTemperature"]

        print(temp_c)
        return temp_c

asyncio.run(get_indoor_temperature_c())
@home:~/Downloads/c$ python3 lg.py 
29.5

https://smartsolution.developer.lge.com/en/apiManage/device_profile?s=1734593490507#tag/overview

https://github.com/thinq-connect/pythinqconnect/tree/main

Published by

Leave a Reply

Your email address will not be published. Required fields are marked *