Giter Site home page Giter Site logo

panasonic-comfort-cloud-mqtt's Introduction

 ▄▄   ▄▄ ▄▄▄▄▄▄▄ ▄▄▄     ▄▄▄     ▄▄▄▄▄▄▄    ▄▄▄▄▄▄▄ ▄▄   ▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄   ▄▄▄▄▄▄▄ 
█  █ █  █       █   █   █   █   █       █  █       █  █ █  █       █   ▄  █ █       █
█  █▄█  █    ▄▄▄█   █   █   █   █   ▄   █  █▄     ▄█  █▄█  █    ▄▄▄█  █ █ █ █    ▄▄▄█
█       █   █▄▄▄█   █   █   █   █  █ █  █    █   █ █       █   █▄▄▄█   █▄▄█▄█   █▄▄▄ 
█   ▄   █    ▄▄▄█   █▄▄▄█   █▄▄▄█  █▄█  █    █   █ █   ▄   █    ▄▄▄█    ▄▄  █    ▄▄▄█
█  █ █  █   █▄▄▄█       █       █       █    █   █ █  █ █  █   █▄▄▄█   █  █ █   █▄▄▄ 
█▄▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█▄▄▄▄▄▄▄█    █▄▄▄█ █▄▄█ █▄▄█▄▄▄▄▄▄▄█▄▄▄█  █▄█▄▄▄▄▄▄▄█

Data / Software engineer with passion of simply getting things done. Pure love-hate relation ship with all programming languages and libraries. Lately been having fun with Java, Python, Go, TypeScript and C#.

Mandatory Social Network Things

Mastodon Twitter LinkedIn

panasonic-comfort-cloud-mqtt's People

Contributors

slvwolf avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

panasonic-comfort-cloud-mqtt's Issues

Entity update thread blocked

Main service thread responsible for updating sensor information can get stuck after long running time. Both MQTT and PCC sessions are alive and working even when thread is blocked.

Error handling in general

Project needs some tests and real life testing for properly identify the breaking parts. At minimum handle MQTT errors and sessions errors when communicating with Panasonic Comfort Cloud.

Logging cleanup

Make the service log like a proper service. Remove prints and use proper logging instead.

Handle expiring token

System can get stuck with the following error message -

Sequence of errors detected. Halting requests for 10 minutes: ResponseError('Invalid response, status code: 401 - Data: {"message":"Token expires","code":4100}')

Handle crashes from error code 503

System will crash if encountering error code 503 for a long period of time

2022-09-20 01:01:50,360 - Service - WARNING - Sequence of errors detected. Halting requests for 10 minutes: ResponseError('Invalid response, status code: 503 - Data: {"message":"09/20/2022 01:00 ~ 09/20/2022 03:00 (UTC ± 00)","code":5300}')
2022-09-20 01:11:50,455 - Service - INFO - Resetting connection
2022-09-20 01:11:50,455 - Service - INFO - Connecting to Panasonic Comfort Cloud..
2022-09-20 01:11:52,949 - Service - INFO - Shutting down
Traceback (most recent call last):
  File "/app/run.py", line 4, in <module>
    __main__.main()
  File "/app/pcfmqtt/__main__.py", line 42, in main
    s.start()
  File "/app/pcfmqtt/service.py", line 79, in start
    self.connect_to_cc()
  File "/app/pcfmqtt/service.py", line 45, in connect_to_cc
    self._session.login()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 99, in login
    self._create_token()
  File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 132, in _create_token
    raise ResponseError(response.status_code, response.text)
pcomfortcloud.session.ResponseError: Invalid response, status code: 503 - Data: {"message":"09/20/2022 01:00 ~ 09/20/2022 03:00 (UTC ± 00)","code":5300}

Crash on logout

About

Service can crash on logout during startup,

2023-05-25 10:00:42,610 - Device.pcc_living_room_ac - INFO - Retrieving data
2023-05-25 10:01:14,712 - Device.pcc_living_room_ac - INFO - pcc_living_room_ac: Updated temperature outside ( 18 -> 19 )
2023-05-25 10:01:14,713 - Device.pcc_movie_room_ac - INFO - Retrieving data
2023-05-25 10:01:21,567 - Service - WARNING - Sequence of errors detected. Halting requests for 10 minutes: ResponseError('Invalid response, status code: 500 - Data: {"message":"Adapter Communication error","code":5005}')
2023-05-25 10:11:21,667 - Service - INFO - Resetting connection
2023-05-25 10:11:21,667 - Service - INFO - Connecting to Panasonic Comfort Cloud..
2023-05-25 10:11:25,166 - Service - INFO - Login succesfull. Reading and populating devices
2023-05-25 10:11:25,166 - Device.pcc_living_room_ac - INFO - New device: Living Room (pcc_living_room)
2023-05-25 10:11:25,166 - Device.pcc_living_room_ac - INFO - Retrieving data
2023-05-25 10:11:43,687 - Service - ERROR - Failed initialization to Panasonic Comfort Cloud: Invalid response, status code: 502 - Data: <html>
<head><title>502 Bad Gateway</title></head>
<body>
<center><h1>502 Bad Gateway</h1></center>
</body>
</html>
. Will attempt again in 10 minutes.
2023-05-25 10:11:43,688 - Service - INFO - Starting up MQTT..
2023-05-25 10:11:43,781 - Service - INFO - MQTT started
2023-05-25 10:11:43,788 - Service - INFO - Shutting down
Traceback (most recent call last):
  File "/app/pcfmqtt/service.py", line 104, in start
    self._log.warn("Connection errors. Waiting for 10 minutes: %r", e)
UnboundLocalError: local variable 'e' referenced before assignment

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/run.py", line 4, in <module>
    __main__.main()
  File "/app/pcfmqtt/__main__.py", line 42, in main
    s.start()
  File "/app/pcfmqtt/service.py", line 139, in start
    self._session.logout()
AttributeError: 'NoneType' object has no attribute 'logout'

Health check support

About

Add a health check monitoring and automatic restarting logic to the service.

Docker image

Have a proper easily installable Docker image available and documented.

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.