Skip to content

Trace File of Communication with Bosch Device (Dev Raw Scan)

Simon Hardt edited this page Feb 9, 2024 · 8 revisions

In case of a errors within the Home Assistant integration a raw scan of the Bosch devices is needed to analyze the situation. If the HA integration fails at all, this scan needs to be done from a Linux system e.g a Windows subsystem Linux. The later is especially needed, if a new firmware is deployed by Bosch. This guide describes how to perform a raw scan of your Bosch environment.

Using Home Assistant

Prerequisite

Installation of the integration completed and shows at least one device, if this is not the case, please use the Linux Approach.

The result of the raw_scan or debug_scan will be stored in the folder config/www. Check if this folder exists prior running the scan. If it is not on your system, please create it manually, as the scan will fail without this folder. To check the file system, you may use the offical add on "File Editor" available via Supervisor/Add-on Store.

Run the scan

Go to Developer Tools

Navigate to developer tools

Start the Bosch thermostat: debug_scan

Select Services in the devlopment tools and choose Bosch thermostat: debug_scan in the service drop down. Select your device via the Choose device button and start the scan via the CALL SERVICE button at the bottom.

image

The scan will take quite a while. Upon completion a Notification will appear in your sidebar. Expect a runtime of several minutes. For reference: On a Raspberry Pi 3B the execution of the debug_scan took 25 min. After completion, you will get a notification from Home Assistant in the lower left corner of the UI.

Gather the Result Manually

You may use the add-on File Editor again to view the result of the scan.

Scan Result

Using Linux

Windows setup using Windows Subsystem Linux

Follow the insutrctions here: https://docs.microsoft.com/en-us/windows/wsl/install and setup WSL on your machine. The default Linux installation is a Ubuntu 20.04 LTS (as of Nov 5th, 2021). This will be used for this documentation.

Start the Ubuntu termainal by going to Windows key and searching for Ubuntu 20.04 LTS.

Setup Virtual Environment (VENV)

Install Python 3.11 and virtualenv on Ubuntu

Commands below are for python 3.11. If you have python 3.x replace python3.9 with python3.x.

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11 python3.11-venv

Some background

Configure VENV

Clone and install the different components

cd ~
mkdir bosch
cd bosch
python3.11 -m venv venv
source venv/bin/activate
pip3 install wheel
pip3.11 install bosch-thermostat-client

After a sucessful installation the VENV enviroment is running. This is indicated by a prefix (venv) in the Linux command line and should look like this

(venv) myuser@myhost: ~/bosch$

Starting and stoping the VENV environment

A running VENV is indicated be the prefix (venv) in the Linux command line. To stop the VENV use the command deactivate. Starting VENV is done by via source venv/bin/activate.

Scan for Bosch devices in your network

Run the scan

Use the "bosch_cli scan" command to scan your network for the Bosch gateway and gather information about your setup. Note: For XMPP protocol connections to the Bosch device (e.g. Easycontrol) the host must be the serial number, not the IP.

bosch_cli scan --host=101042138 --token=7Eq4jClmTLAlfbT6 --password=MyPass --protocol=XMPP --device=EASYCONTROL

The output of the scan may look like this:

(venv) user@Base:~/bosch/venv/share/python-wheels$ bosch_cli scan --host=101042138 --token=7Eq4jClmTLAlfbT6 --password=MyPass --protocol=XMPP --device=EASYCONTROL -d  
2021-11-07 12:45:50 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Debug mode active  
2021-11-07 12:45:51 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Running scan  
2021-11-07 12:45:51 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Successfully connected to gateway. Found UUID: 123456789  
2021-11-07 12:45:51 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 5', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:45:51 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /systemStates  
2021-11-07 12:45:55 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 405 Method Not Allowed', 'Seq-No: 52', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:45:55 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /gateway/test/EEPROMvalues
2021-11-07 12:46:06 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 182', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:06 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /solarCircuits  
2021-11-07 12:46:06 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 183', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:06 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /recordings
2021-11-07 12:46:17 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 400 Bad Request', 'Seq-No: 0', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:17 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /devices/productLookup  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 0', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /ecus  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 0', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /application  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] 400 HTTP Error - ['HTTP/1.1 404 Not Found', 'Seq-No: 0', 'Content-Length: 0', 'Content-Type: application/json', 'Connection: close', '', '']  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.connectors.xmpp] Msg exception for /gservice_tariff  
2021-11-07 12:46:29 INFO (MainThread) [bosch_thermostat_client.bosch_cli] Successfully saved result to file: rawscan_101021324.json  

The HTTP error statments do not indicate a failure of the scan. Some HTTP requests were not answered for this device. The critical line is "Successfully connected to gateway. Found UUID: 101042138 ".

Troubleshooting

Double check the host serial and the token. They are 9 digit numbers and upper/lower characters for a CT200 Easycontrol. No spaces. Please also double check the passwort. For CT200 it is to be set in the EasyControl App within the section "Settings"-"Personal".

The scan may fail due to an unknown firmware of the device. Use the -i flag in bosch_cli scan in this case

bosch_cli scan -i --host=SERIAL --token=XXXX --password=YYYY --protocol=XMPP --device=IVT

Rawscan sample

For the scan above the HTTP exceptions show as "not found" in the JSON, whis is in line with expectations.

  {
     "/systemStates": "not found"
  },

The scan will show the gateway (e.g. the CT200) and the connected sensors. Details of your home system should be visible in your JSON. E.g. search for "/gateway/versionFirmware" to find the firmware version of you gateway.

       {
            "id": "/gateway/versionFirmware",
            "type": "stringValue",
            "writeable": 0,
            "recordable": 0,
            "value": "03.06.05"
        }

The different sensors/thermostat are listed in the section " "id": "/devices",". In this example, we have one gateway and 5 valves.

        {
            "id": "/devices",
            "type": "refEnum",
            "references": [
                {
                    "id": "/devices/dev1"
                },
                {
                    "id": "/devices/dev2"
                },
                {
                    "id": "/devices/dev3"
                },
                {
                    "id": "/devices/dev4"
                },
                {
                    "id": "/devices/dev5"
                },
                {
                    "id": "/devices/dev6"
                },
                {
                    "id": "/devices/device1"
                },
                {
                    "id": "/devices/device2"
                },
                {
                    "id": "/devices/device3"
                },
                {
                    "id": "/devices/device4"
                },
                {
                    "id": "/devices/device5"
                },
                {
                    "id": "/devices/device6"
                },
                {
                    "id": "/devices/list"
                },
                {
                    "id": "/devices/productLookup"
                }
            ]
        }

You should find your gateway name in the node "id": "/devices/device1/name".

        {
            "id": "/devices/device1/name",
            "type": "stringValue",
            "writeable": 1,
            "recordable": 0,
            "value": "EasyControl"
        }

In a working Bosch client connection, you should be able to find many details of your home setup.

Additional details

Reference bosch_cli scan usage

For more info about command creation run:

bosch_cli scan --help

Options as Nov 7th, 2021:

Usage: bosch_cli scan [OPTIONS]
Create rawscan of Bosch thermostat.

Options:
  --host TEXT                     IP address of gateway or SERIAL for XMPP
                                  [required]
  --token TEXT                    Token from sticker without dashes.
                                  [required]
  --password TEXT                 Password you set in mobile app.
  --protocol [XMPP|HTTP]          Bosch protocol. Either XMPP or HTTP.
                                  [required]
  --device [NEFIT|IVT|EASYCONTROL]
                                  Bosch device type. NEFIT, IVT or
                                  EASYCONTROL.  [required]
  -d, --debug                     Set Debug mode. Single debug is debug of
                                  this lib. Second d is debug of aioxmpp as
                                  well.
  -o, --output TEXT               Path to output file of scan. Default to
                                  [raw/small]scan_uuid.json
  --stdout                        Print scan to stdout
  -d, --debug
  -i, --ignore-unknown            Ignore unknown device type. Try to scan
                                  anyway. Useful for discovering new devices.
  -s, --smallscan [HC|DHW|SENSORS|RECORDINGS]
                                  Scan only single circuit of thermostat.
  --help                          Show this message and exit.

VENV Background

software-properties-common provides an abstraction of the used apt repositories. It allows you to easily manage your distribution and independent software vendor software sources.

deadsnakes are new and old Python versions for Ubuntu.

python3.11-venv is a tool used to create an isolated Python environment. This environment has its own installation directories that doesn't share libraries with other virtualenv environments (and optionally doesn't access the globally installed libraries either).

Starting and stoping the VENV environment is done by either source venv/bin/activate or simply by the command deactivate.

A running VENV environment is indicate by a command line that shows a prefix (venv).