Home-Assistant MQTT bridge for Panasonic Comfort Cloud

Overview

Panasonic Comfort Cloud MQTT Bridge

Home-Assistant MQTT bridge for Panasonic Comfort Cloud.

Note: Currently this brige is a one evening prototype project. Main features should work but corner cases will definitely cause problems. Current version has only been tested with model CS-HZ25UKE. Let me know if you hit any issues.

HA

Uses pcomfortcloud for Panasonic Comfort Cloud and paho-mqtt for MQTT.

Features

  • Auto-discovery notification for HA
  • Operating mode support
  • Target temperature support
  • State verification updates

Usage

usage: run.py [-h] [-u USERNAME] [-P PASSWORD] [-s SERVER] [-p PORT] [-t TOPIC]

Home-Assistant MQTT bridge for Panasonic Comfort Cloud

optional arguments:
-h, --help            show this help message and exit
-u USERNAME, --username USERNAME
                        Panasonic Comfort Cloud username, usually email address. Environment variable `USERNAME`
-P PASSWORD, --password PASSWORD
                        Panasonic Comfort Cloud password. Environment variable `PASSWORD`
-s SERVER, --server SERVER
                        MQTT server address, default `localhost`. Environment variable: `MQTT`
-p PORT, --port PORT  MQTT server port, default 1883. Environment variable `MQTT_PORT`
-t TOPIC, --topic TOPIC
                        MQTT discovery topic prefix, default `homeassistant`. Environment variable TOPIC_PREFIX.

Example install / use,

pip3 install .
python3 run.py -u [email protected] -P 123password -s 127.0.0.1

Missing Features

High Priority

  • Error handling in general
  • Proper entity id generation (currenlty will fail with really wild names)
  • Additonal sensors for inside and outside temperature
  • Proper documentation
  • Docker package
  • Proper shutdown

Maybe Someday

  • Fan mode support
  • Support for Eco mode
  • Support for Nano mode
  • Fan speed support
  • Service state events
  • Stop listening to all events in HA topic
  • Power usage metrics
Comments
  • Comfort Cloud API returning `Forbidden`

    Comfort Cloud API returning `Forbidden`

    About

    Currently the Comfort Cloud API is returning forbidden due to app version mismatch. pcomfortcloud needs to be updated once the problem has been resolved in the underlying library.

    Related Issue

    https://github.com/lostfields/python-panasonic-comfort-cloud/issues/64

    bug 
    opened by slvwolf 2
  • Fix version mismatch

    Fix version mismatch

    About

    Address error coming from version mismatch -

    Traceback (most recent call last):
      File "/app/pcfmqtt/service.py", line 83, in start
        if device.update_state(self._session, self._update_interval):
      File "/app/pcfmqtt/device.py", line 92, in update_state
        data = session.get_device(self._id)
      File "/usr/local/lib/python3.9/site-packages/pcomfortcloud/session.py", line 274, in get_device
        raise ResponseError(response.status_code, response.text)
    pcomfortcloud.session.ResponseError: Invalid response, status code: 401 - Data: {"message":"New version app has been published","code":4106}
    

    Related

    • https://github.com/lostfields/python-panasonic-comfort-cloud/issues/71
    enhancement 
    opened by slvwolf 0
  • Reset MQTT and Cloud connection on error

    Reset MQTT and Cloud connection on error

    About

    When encountering serious error even after re-attempt reset the MQTT and Comfort Cloud connection to start from fresh

    Workaround fix for forbidden problem #13

    Temporarily fixes version problem in library dependency causing forbidden when logging in

    enhancement 
    opened by slvwolf 0
  • Handle expiring token

    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}')

    bug good first issue 
    opened by slvwolf 0
  • Entity update thread blocked

    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.

    bug 
    opened by slvwolf 0
  • Error handling in general

    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.

    bug enhancement 
    opened by slvwolf 0
  • Handle crashes from error code 503

    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}
    
    bug 
    opened by slvwolf 0
Releases(v0.4.2)
  • v0.4.2(Oct 14, 2022)

  • v0.4.1(Jul 14, 2022)

    Improvements,

    • Automatic reset of MQTT connection and Panasonic Comfort Cloud when encountering unhandled exceptions

    Fixes,

    • Workaround fix applied to go around issue with API returning forbidden
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(May 22, 2022)

    Features,

    • Desired state support. Instead of trusting the Comfort Cloud to keep the current state when turning the device off, use own state instead. If service is restarted the desired state is retrieved from the cloud. This helps with retaining the mode state when turning the device on and off.
    • Improved logging. Plenty of additional details are now provided with nicer syntax. Logging level can be controlled with environment variable if needed.

    Improvements,

    • Better responsiveness. New states should be much faster reflected in Home Assistant.
    Source code(tar.gz)
    Source code(zip)
  • v0.3.3(Feb 6, 2022)

  • v0.3.1(Jan 14, 2022)

  • v0.3.0(Jan 8, 2022)

    Features,

    • Respects HA birth and last will events. Service will now resend all configuration when detecting Home Assistant was restarted. In addition configuration will be refreshed every 60 minutes in case HA status messages are missed.
    Source code(tar.gz)
    Source code(zip)
  • v0.2.1(Jan 8, 2022)

  • v0.2.0(Jan 8, 2022)

    Incremental feature updates,

    • Temperature sensors for outside and inside
    • Delayed device update on state changes
    • Own power command for retaining the original mode state in device
    • Proper shutdown when running from terminal
    • Correct HA icons and types for entities
    Source code(tar.gz)
    Source code(zip)
  • v0.1(Jan 7, 2022)

    First working prototype with following features,

    • Auto-discovery notification for HA
    • Operating mode support
    • Target temperature support
    • State verification updates
    Source code(tar.gz)
    Source code(zip)
Owner
Santtu Järvi
Data-wolf engineer
Santtu Järvi
DNP3 Stalker is a project to analyze and interact with DNP3 devices

DNP3 Stalker Purpose DNP3 Stalker is a project to analyze and interact with DNP3

Cutaway Security, LLC. 2 Feb 10, 2022
Hourglass on the pi pico using circuitpython

hourglass-on-pico "Hourglass" on the raspberry pi pico using circuitpython circuitpython version 7.0.0 Components used: Raspberry Pi Pico ADXL345 acce

4 Jul 18, 2022
My self-hosting infrastructure, fully automated from empty disk to operating services

Khue's Homelab Current status: ALPHA This project utilizes Infrastructure as Code to automate provisioning, operating, and updating self-hosted servic

Khue Doan 6.4k Dec 31, 2022
gdsfactory is an EDA (electronics design automation) tool to Layout Integrated Circuits.

gdsfactory 3.5.5 gdsfactory is an EDA (electronics design automation) tool to Layout Integrated Circuits. It is build on top of phidl gdspy and klayou

147 Jan 04, 2023
Monitor an EnvisaLink alarm module running Honeywell firmware, and set a Nest device to Home/Away depending on whether the alarm is Disarmed/Away.

Nestalarm Monitor an EnvisaLink alarm module running Honeywell firmware, and set a Nest device to Home/Away depending on whether the alarm is Disarmed

1 Dec 30, 2021
This Home Assistant custom component adding support for controlling Midea dehumidifiers on local network.

This custom component for Home Assistant adds support for Midea air conditioner and dehumidifier appliances via the local area network. homeassistant-

Nenad Bogojevic 92 Dec 31, 2022
A ESP32 project template with a web interface built in React

ESP AP Webserver demo.mp4 This is my experiment with "mobile app development" for the ESP32. The project consists of two parts, the ESP32 code and the

8 Dec 15, 2022
ArduinoWaterHeaterIOT - IoT Probe of a solar PV water heating system - Arduino, Python, MQTT, MySQL

ArduinoWaterHeaterIOT IoT Probe of a solar PV water heating system - Arduino, Raspberry Pi, Python, MQTT, MySQL The Arduino sends the AC and DC watts

Jacques Fourie 1 Jan 11, 2022
Lego Mindstorms EV3 and Lego Spike Prime

Lego Mindstorms EV3 and Lego Spike Prime What is FLL? The FIRST LEGO League Challenge Robotics Tournament challenges students from 9 to 16 years old t

Danimar Campos da Costa 1 Nov 14, 2021
Workshop for student hackathons focused on IoT dev

Scenario: The Mutt Matcher (IoT version) According to the World Health Organization there are more than 200 million stray dogs worldwide. The American

Microsoft 15 Aug 10, 2022
A circle of LEDs

This repository contains all the design files, production files and example code for a simple circular LED display.

Pim de Groot 15 Aug 21, 2022
Final-project-robokeeper created by GitHub Classroom

RoboKeeper! Jonny Bosnich, Joshua Cho, Lio Liang, Marco Morales, Cody Nichoson Demonstration Videos Grabbing the paddle: https://youtu.be/N0HPvFNHrTw

Cody Nichoson 1 Dec 12, 2021
Universal Xiaomi MIoT integration for Home Assistant

Xiaomi MIoT Raw 简体中文 | English MIoT 协议是小米智能家居从 2018 年起推行的智能设备通信协议规范,此后凡是可接入米家的设备均通过此协议进行通信。此插件按照 MIoT 协议规范与设备通信,实现对设备的状态读取及控制。

1.9k Jan 02, 2023
Self Driving Car Prototype

Package Delivery Rover 🚀 This project is a prototype of Self Driving Car. It's based on embedded systems, to meet the current requirement of delivery

Abhishek Pawar 1 Oct 31, 2021
This is the remake of the program PYOBD. It works on Python3 and all new libraries. It was tested on Linux, Windows, and it should work on MAC too.

This is the remake of the program PYOBD. It works on Python3 and all new libraries. It was tested on Linux, Windows, and it should work on MAC too. You just need an ELM327 USB or bluetooth device and

127 Jan 06, 2023
Uses the Duke Energy Gateway to import near real time energy usage into Home Assistant

Duke Energy Gateway This is a custom integration for Home Assistant. It pulls near-real-time energy usage from Duke Energy via the Duke Energy Gateway

Michael Meli 28 Dec 23, 2022
Example code to sending USB Gadget multimedia keys via Python

Send Multimedia USB HID Keys via Python As an USB Gadget in Linux This gives a simple script with zero dependencies that can easily run on any Linux d

DevOps Nirvana 2 Jan 02, 2023
A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost.

distance sensor cube timer A rubiks cube timer using a distance sensor and a raspberry pi 4, and possibly the pi pico to reduce size and cost. How to

3 Feb 21, 2022
Extremely simple PyBadge examples to demonstrate different aspects of CircuitPython using PyBadge hardware.

BeginnerPyBadge I purchased a PyBadge recently. I'm new to hardware. I was surprised how hard it was to find easy examples demonstrating how different

Rubini LaForest 2 Oct 21, 2021
Create (templateable) cameras that display qr codes in homeassistant

QRCam This custom component creates cameras displaying qrcodes. The QRCodes can be static or generated from templates. If you use a template as conten

Jannes Müller 5 Oct 06, 2022