bosch-thermostat / home-assistant-bosch-custom-component

HA custom component for Bosch thermostats
Apache License 2.0
214 stars 45 forks source link

Additional information on IVT #99

Closed prj closed 2 years ago

prj commented 2 years ago

Hello,

I reversed the EasyRemote app and there's a whole additional root path that is not used in the component right now. In case of my pump it shows a lot of useful data.

{
    "id": "/systemStates",
    "references": [
        {
            "id": "/systemStates/compressor",
            "uri": "http://192.168.1.45/systemStates/compressor"
        },
        {
            "id": "/systemStates/additionalHeater",
            "uri": "http://192.168.1.45/systemStates/additionalHeater"
        },
        {
            "id": "/systemStates/summaryAlarm",
            "uri": "http://192.168.1.45/systemStates/summaryAlarm"
        },
        {
            "id": "/systemStates/CompressorMotorProtection",
            "uri": "http://192.168.1.45/systemStates/CompressorMotorProtection"
        },
        {
            "id": "/systemStates/ColdCarrierPumpMotorProtection",
            "uri": "http://192.168.1.45/systemStates/ColdCarrierPumpMotorProtection"
        },
        {
            "id": "/systemStates/alarmPowerSupply",
            "uri": "http://192.168.1.45/systemStates/alarmPowerSupply"
        },
        {
            "id": "/systemStates/lowPressureState",
            "uri": "http://192.168.1.45/systemStates/lowPressureState"
        },
        {
            "id": "/systemStates/highPressureState",
            "uri": "http://192.168.1.45/systemStates/highPressureState"
        }
    ],
    "type": "refEnum"
}

There's also "/application".

I modified the init.py file in const folder, added these two into ROOTS, and ran the scan, but this did not add them to the scan. Probably I am missing something...

prj commented 2 years ago

Another one is "/gservice_tariff" it contains electric market data if the heatpump supports it.

prj commented 2 years ago

Tried creating a custom json db file, but that does not seem to work either. I can't even figure out from where the entities get populated, guess will need to wait for some input from your side.

pszafer commented 2 years ago

You have to add it here https://github.com/bosch-thermostat/bosch-thermostat-client-python/blob/d247685fab4a29c6973bdfa7a4e8bddaa0d34627/bosch_thermostat_client/const/__init__.py#L104

so it would be:

ROOT_PATHS = [
    "/dhwCircuits",
    "/gateway",
    "/heatingCircuits",
    "/heatSources",
    "/notifications",
    "/system",
    "/systemStates",
    "/solarCircuits",
    "/recordings",
    "/devices",
    "/energy",
    "/events",
    "/programs",
    "/zones",
    "/ecus",
        "/application",
"/gservice_tariff"
]

If it's empty then maybe it return 404 for all the URIs insided or it's forbidden to fetch with user access token

prj commented 2 years ago

It works perfectly fetching it manually with user access token. And yes I added them in that exact position:

ROOT_PATHS = [
    "/dhwCircuits",
    "/gateway",
    "/heatingCircuits",
    "/heatSources",
    "/notifications",
    "/system",
    "/systemStates",
    "/solarCircuits",
    "/recordings",
    "/devices",
    "/energy",
    "/events",
    "/programs",
    "/zones",
    "/ecus",
    "/application",
    "/gservice_tariff"
]

But this has no effect on the scan for some reason. When I run the scan it spits out a file without any of the data. I have a lot of experience with software development, but I have done very little in python, so it is a little hard for me to follow. Maybe I am missing something obvious.

prj commented 2 years ago

So many bugs :(

I adjusted the custom_initialize functionality so that it actually checks for the custom db. This was before nested into if's so that this would never happen.

Now I get this error:

2021-10-17 22:13:21 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry iCom_low_CAN_v1 CAN for bosch
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 304, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/config/custom_components/bosch/__init__.py", line 124, in async_setup_entry
return await gateway_entry.async_init()
File "/config/custom_components/bosch/__init__.py", line 206, in async_init
if await self.async_init_bosch():
File "/config/custom_components/bosch/__init__.py", line 271, in async_init_bosch
self.gateway.custom_initialize(custom_db)
File "/usr/local/lib/python3.9/site-packages/bosch_thermostat_client/gateway/base.py", line 96, in custom_initialize
initial_db = get_initial_db()
TypeError: get_initial_db() missing 1 required positional argument: 'device_type'

This is because of a bug here in thhermostat client:

    def custom_initialize(self, extra_db):
        "Custom initialization of component"
        if self._firmware_version:
            self._db = get_custom_db(self._firmware_version, extra_db)
            initial_db = get_initial_db()
            initial_db.pop(MODELS, None)
            self._db.update(initial_db)
            self._initialized = True

You are supposed to call get_initial_db() with device type as argument apparently.

I learned enough that I can hack the main module in the home assistant through the terminal, but I have no idea what to do with the dependency or where it is stored... Or how to even get into some kind of development mode.

Otherwise I could test this and submit a PR.

pszafer commented 2 years ago

I abandoned idea of custom_initialize while ago... My idea was that anybody could add their device info and work on it. Eventually it was a nightmare, because there are too many depends in Bosch devices. Eg If you have DHW in follow ch mode, then if you change mode in HC, you are switching mode in DHW and user'd need to understand those processes to create proper db.

In 0.16.1 I added those URI's you are talking about so you can scan it.

pszafer commented 2 years ago

About development. It'd be great if you can contribute! This is wiki I created https://github.com/bosch-thermostat/home-assistant-bosch-custom-component/wiki/Dev-environment-setup and https://developers.home-assistant.io/docs/api_lib_index/#trying-your-library-inside-home-assistant For simple things I use my simulator https://github.com/bosch-thermostat/bosch_thermostat_http_simulator so I can test it on different devices

prj commented 2 years ago

So by getting rid of the custom_initialize, I do not have any chance to do anything if the problem is in bosch-thermostat-client-python. I can not provide my own configuration for testing, I can not modify an existing configuration, I can not fix any bugs there, because it is automatically packaged into docker somewhere and as I understand overwritten on every restart.

So I have to learn and understand the whole system of how to change a package reference and where it can be downloaded from, then branch the repo, and then make a custom dependency.

If you ask me this is a huge pain just to test a couple of endpoints. I'll do a scan with the next version, but the scan won't get me anywhere, because I can't modify 010701.json to add what I need there. And because custom is off I can't test anything.

The dev environment setup seems like a proper chore to add and test a couple of endpoints and the documentation seems out of date for current home assistant version.

The learning curve here is like a 90 degree vertical wall, the way everything is structured certainly does not encourage any contribution.

prj commented 2 years ago

So, even running a scan:

Download json file and attach it somewhere. The json file is stored under /www/bosch_scan.json. Please make sure the www folder exists prior to running the scan

What is "/www". Should it be typed into a browser? Should it be in the file system root? It certainly is not in the file system root and in the browser it gives a 404.

I'll check out the git and run it manually from my PC, but the instructions could really be at least a little bit clear.

prj commented 2 years ago

rawscan_757210046.zip

Here's the rawscan. None of the new paths are there, as I expected, because I did the same modification to roots as you and it did absolutely nothing. If I set it to debug mode it does not print anything useful. Here's manual query of the relevant two entries for at least systemStates. These should be added to 010701.json, I guess I will figure out how to do that...

{
    "id": "/systemStates",
    "references": [
        {
            "id": "/systemStates/compressor",
            "uri": "http://192.168.1.45/systemStates/compressor"
        },
        {
            "id": "/systemStates/additionalHeater",
            "uri": "http://192.168.1.45/systemStates/additionalHeater"
        },
        {
            "id": "/systemStates/summaryAlarm",
            "uri": "http://192.168.1.45/systemStates/summaryAlarm"
        },
        {
            "id": "/systemStates/CompressorMotorProtection",
            "uri": "http://192.168.1.45/systemStates/CompressorMotorProtection"
        },
        {
            "id": "/systemStates/ColdCarrierPumpMotorProtection",
            "uri": "http://192.168.1.45/systemStates/ColdCarrierPumpMotorProtection"
        },
        {
            "id": "/systemStates/alarmPowerSupply",
            "uri": "http://192.168.1.45/systemStates/alarmPowerSupply"
        },
        {
            "id": "/systemStates/lowPressureState",
            "uri": "http://192.168.1.45/systemStates/lowPressureState"
        },
        {
            "id": "/systemStates/highPressureState",
            "uri": "http://192.168.1.45/systemStates/highPressureState"
        }
    ],
    "type": "refEnum"
}

Compressor:

{
    "allowedValues": [
        "ON",
        "OFF"
    ],
    "id": "/systemStates/compressor",
    "recordable": 0,
    "type": "stringValue",
    "value": "ON",
    "writeable": 0
}
{
    "id": "/systemStates/additionalHeater",
    "recordable": 0,
    "type": "floatValue",
    "unitOfMeasure": "%",
    "value": 0,
    "writeable": 0
}
pszafer commented 2 years ago

Don't try to do development in Docker or your stable HA instance. Install it on your PC and then run lib locally. It's easier and faster.

Scan you sent is not made by 0.16.1 version of lib. In 0.16.1 if something is not visible then I print:

{
        "/systemStates": "not found"
},
prj commented 2 years ago

I downloaded the dev branch from here: https://github.com/bosch-thermostat/bosch-thermostat-client-python

And then I ran bosch_cli scan from command line on my PC.

If I look at the __init__.py in const, I have:

ROOT_PATHS = [
    "/systemStates",
    "/dhwCircuits",
    "/gateway",
    "/heatingCircuits",
    "/heatSources",
    "/notifications",
    "/system",
    "/solarCircuits",
    "/recordings",
    "/devices",
    "/energy",
    "/events",
    "/programs",
    "/zones",
    "/ecus",
    "/application",
    "/gservice_tariff",
]

What should I download instead?

pszafer commented 2 years ago

did you create venv and install it as editable? If not then you are using system-wide bosch_cli installation. Run bosch_cli --version and check.

prj commented 2 years ago

I found the problem after I added some info to helper. I indeed had a pip package installed, which was overriding what I was running. This is because I'm a noob at python.

I removed the package and set PYTHONPATH manually, so I could execute the library from the folder. I also modified helper logging to see what it is doing.

Here's the output:

2021-10-18 12:05:30 INFO (MainThread) [__main__] Running scan
2021-10-18 12:05:30 INFO (MainThread) [__main__] Successfully connected to gateway. Found UUID: 757210046
2021-10-18 12:05:30 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates
2021-10-18 12:05:30 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/compressor
2021-10-18 12:05:30 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/additionalHeater
2021-10-18 12:05:30 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/summaryAlarm
2021-10-18 12:05:31 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/CompressorMotorProtection
2021-10-18 12:05:31 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/ColdCarrierPumpMotorProtection
2021-10-18 12:05:31 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/alarmPowerSupply
2021-10-18 12:05:32 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/lowPressureState
2021-10-18 12:05:33 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /systemStates/highPressureState
2021-10-18 12:05:33 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits
2021-10-18 12:05:33 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1
2021-10-18 12:05:33 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/actualTemp
2021-10-18 12:05:34 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/setTemperature
2021-10-18 12:05:35 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/activatedTemperatureLevel
2021-10-18 12:05:35 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/activeDhwTimeProgram
2021-10-18 12:05:36 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/currentSetpoint
2021-10-18 12:05:37 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwTimePrograms
2021-10-18 12:05:37 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwTimePrograms/AlwaysHotWater
2021-10-18 12:05:38 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwTimePrograms/Program1
2021-10-18 12:05:38 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwTimePrograms/Program2
2021-10-18 12:05:39 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwSpLevels
2021-10-18 12:05:39 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwSpLevels/on
2021-10-18 12:05:39 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/dhwSpLevels/off
2021-10-18 12:05:40 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/extraDhw
2021-10-18 12:05:40 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/extraDhw/stopTemp
2021-10-18 12:05:40 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/extraDhw/time
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/extraDhw/activationStatus
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /dhwCircuits/dhw1/extraDhw/status
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/uuid
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/firmware
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/userpassword
2021-10-18 12:05:41 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/versionFirmware
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/versionHardware
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/language
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gateway/DateTime
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/activeSwitchProgram
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/switchPrograms
2021-10-18 12:05:42 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/switchPrograms/Program1
2021-10-18 12:05:43 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/switchPrograms/Program2
2021-10-18 12:05:45 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/temperatureLevels
2021-10-18 12:05:45 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/temperatureLevels/exception
2021-10-18 12:05:46 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/temperatureLevels/normal
2021-10-18 12:05:46 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/heatingCurveSetting
2021-10-18 12:05:46 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/heatingCurveSetting/percentage
2021-10-18 12:05:47 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/heatingCurveSetting/increment
2021-10-18 12:05:47 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/heatingCurveSetting/decrement
2021-10-18 12:05:47 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/holidayMode
2021-10-18 12:05:47 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/holidayMode/activated
2021-10-18 12:05:48 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/holidayMode/startStop
2021-10-18 12:05:49 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/supplyTemperatureSetpoint
2021-10-18 12:05:49 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc1/status
2021-10-18 12:05:49 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2
2021-10-18 12:05:50 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/activeSwitchProgram
2021-10-18 12:05:50 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/switchPrograms
2021-10-18 12:05:50 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/switchPrograms/Program1
2021-10-18 12:05:51 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/switchPrograms/Program2
2021-10-18 12:05:52 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/temperatureLevels
2021-10-18 12:05:52 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/temperatureLevels/exception
2021-10-18 12:05:53 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/temperatureLevels/normal
2021-10-18 12:05:53 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/heatingCurveSetting
2021-10-18 12:05:53 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/heatingCurveSetting/percentage
2021-10-18 12:05:54 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/heatingCurveSetting/increment
2021-10-18 12:05:54 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/heatingCurveSetting/decrement
2021-10-18 12:05:55 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/holidayMode
2021-10-18 12:05:55 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/holidayMode/activated
2021-10-18 12:05:55 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/holidayMode/startStop
2021-10-18 12:05:55 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/supplyTemperatureSetpoint
2021-10-18 12:05:57 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatingCircuits/hc2/status
2021-10-18 12:05:57 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /heatSources
2021-10-18 12:05:57 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /notifications
2021-10-18 12:05:57 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system
2021-10-18 12:05:57 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/brand
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/bus
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/systemType
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/sensors
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/sensors/outdoorTemperatures
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/sensors/outdoorTemperatures/t1
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/appliance
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /system/appliance/type
2021-10-18 12:05:58 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /solarCircuits
2021-10-18 12:05:59 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings
2021-10-18 12:05:59 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/dhwCircuits
2021-10-18 12:05:59 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/dhwCircuits/dhw1
2021-10-18 12:05:59 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/dhwCircuits/dhw1/actualTemp
2021-10-18 12:06:00 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/system
2021-10-18 12:06:00 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/system/sensors
2021-10-18 12:06:00 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/system/sensors/outdoorTemperatures
2021-10-18 12:06:00 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/system/sensors/outdoorTemperatures/t1
2021-10-18 12:06:00 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/heatingCircuits
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/heatingCircuits/hc1
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /recordings/heatingCircuits/hc2
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /devices
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /energy
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /events
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /programs
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /zones
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /ecus
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application
2021-10-18 12:06:01 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/tbso
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/tbso/electricity
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/tbso/electricity/tariffID
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/tbso/electricity/setPointDayOverlay
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/tbso/enable
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc1
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc1/tbso
2021-10-18 12:06:02 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc1/tbso/roomTempOptDelta
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc1/tbso/enable
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc1/normalTemp
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc2
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc2/tbso
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc2/tbso/roomTempOptDelta
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc2/tbso/enable
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc2/normalTemp
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc3
2021-10-18 12:06:03 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc3/tbso
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc3/tbso/roomTempOptDelta
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc3/tbso/enable
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc3/normalTemp
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc4
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc4/tbso
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc4/tbso/roomTempOptDelta
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc4/tbso/enable
2021-10-18 12:06:04 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /application/setpointScheduler/hc4/normalTemp
2021-10-18 12:06:05 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gservice_tariff
2021-10-18 12:06:05 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gservice_tariff/relativePrice
2021-10-18 12:06:05 INFO (MainThread) [bosch_thermostat_client.helper] Fetching URL: /gservice_tariff/relativePrice/*
2021-10-18 12:06:05 INFO (MainThread) [__main__] Successfully saved result to file: rawscan_757210046.json

And here's the rawscan: rawscan_757210046.zip

I don't have any logic for monitoring the electricity price (maybe using these API's it's actually possible to automate the pump to force heat everything up when the electricity is very cheap, but this is not so important now).

But the /systemStates are very important, because it shows the aux heater duty if it is turned on and whether the pump itself is turned on. This can help to monitor the duty cycle per 24 hours of the pump.

prj commented 2 years ago

Editing the sensors like this could be useful in the db I think?

    "sensors": {
        "outdoor_t1": {
            "id": "/system/sensors/outdoorTemperatures/t1",
            "name": "Outdoor temperature"
        },
        "compressor": {
            "id": "/systemStates/compressor",
            "name": "Compressor"
        },
        "additional_heater": {
            "id": "/systemStates/additionalHeater",
            "name": "Additional heater"
        }
    }

Also maybe the extradhw could be explored a little. If it is possible to not only read but actually enable it for X hours, that would be pretty useful. One could write a script that monitors the current electricity price and if it is lower than a pre-set amount during night, one could activate the extradhw for that duration, so you pre-heat the water for morning to 65C for "free".

pszafer commented 2 years ago

I can add those sensor for you. for turning on/off based on electricity is pretty simple. you can create template sensor with price of electricity and automation based on low price.

prj commented 2 years ago

Looking a little more at it, seems like "setPointDayOverlay" can be written and then "setpointScheduler" can be enabled for a hc. Over here we have something called "Nordpool dayahead market data", which I can fetch here: https://dashboard.elering.ee/api/nps/price/csv?end=2021-10-20T23:59:59.999Z&fields=ee I think I could make a REST sensor and parse in the data.

Using this data it could be possible to create a price based overlay onto the heatpump setpoint - lower it a little when electricity is expensive, increase it when electricity is cheap. Since my house is completely controlled by thermostats anyway, a too "high" setpoint does not actually hurt anything.

And in addition I see that "extraDhw" has "time" writable (this is same like in control panel).

How do I actually write something to an endpoint and not only read?

pszafer commented 2 years ago

All other device types I've already upgraded. CAN is last on my todo list, but I haven't had current scan of it (now I have thanks to you!). If you'd like to contribute then analyze this db: https://github.com/bosch-thermostat/bosch-thermostat-client-python/blob/dev/bosch_thermostat_client/db/rc300_rc200/040707.json

And then sensors have to be moved to switches, binary sensors, input_number etc, so it would be editable. If you'd rather wait for me, I can do it tomorrow afternoon.

In the end it can look like this: image

Nice API you have. You can download straight json https://dashboard.elering.ee/api/nps/price?start=2021-10-18T10:00:59.999Z&end=2021-10-18T13:00:59.999Z and rest sensor + maybe template sensor would work for you

prj commented 2 years ago

I looked at it a little, if you have the motivation to do it, then I'd rather leave it to you. It will take me much longer, because I am not only fairly bad at python, but I am also very new to HA in general.

I will try to implement the REST sensor for the electricity prices first.

pszafer commented 2 years ago

ok, I will try to add it tomorrow.

about REST sensor, I'd use Node Red for this purpose. It can be made with simple javascript in a few steps and put into HA. In HA you'd need REST sensor and template sensor to extract proper key from json you fetched and you're limited in REST to 255 chars.

prj commented 2 years ago

I think electricity might need a custom component anyway, because it's not a typical sensor per-se. I mean you can make it like a sensor, but it's really a bunch of values with "ahead" data. I don't think it's very straightforward to fit that into home assistant.

EDIT: Actually I see that NODE-RED is some UI thing, and it has the ability to directly insert data at accurate timestamp. This is good, I will get on it, thank you for the tip!

pszafer commented 2 years ago

hi, I tried to add extra dhw, but unfortunately I can't find anything writable in it. I don't know how to turn it on

{
            "id": "/dhwCircuits/dhw1/extraDhw/stopTemp",
            "type": "floatValue",
            "writeable": 1,
            "recordable": 0,
            "value": 65.0,
            "unitOfMeasure": "C",
            "minValue": 50.0,
            "maxValue": 65.0
        },
        {
            "id": "/dhwCircuits/dhw1/extraDhw/time",
            "type": "floatValue",
            "writeable": 1,
            "recordable": 0,
            "value": 0.0,
            "unitOfMeasure": "hour",
            "minValue": 0.0,
            "maxValue": 48.0
        },
        {
            "id": "/dhwCircuits/dhw1/extraDhw/activationStatus",
            "type": "stringValue",
            "writeable": 0,
            "recordable": 0,
            "value": "OFF",
            "allowedValues": [
                "ON",
                "OFF"
            ]
        },
        {
            "id": "/dhwCircuits/dhw1/extraDhw/status",
            "type": "stringValue",
            "writeable": 0,
            "recordable": 0,
            "value": "ON",
            "allowedValues": [
                "OFF",
                "ON"
            ]
        }

All uris are read-only.

prj commented 2 years ago

To turn it on you set the active time. Confusing i know but that is how it is in the panel too.

So if you set active time to 2 hours it turns on immediately and is active for 2 hours unless you set time back to zero.

dhwCircuits/dhw1/extraDhw/time - this needs to be written and it activates it immediately if it is not 0.

pszafer commented 2 years ago

Test it out: https://github.com/bosch-thermostat/home-assistant-bosch-custom-component/releases/tag/v0.16.2

prj commented 2 years ago

So the compressor and additional heat state works great, but I can't seem to access the switches for the extradhw.

pszafer commented 2 years ago

Did you enable them in water heater device?

prj commented 2 years ago

I need to enable them separately as number.charge_duration and number.stop_temp. I removed and re-added the device and now they showed up, or maybe they were showing before but the "number" threw me off.

prj commented 2 years ago

OK, it's working fine. I set extra hot water to 1 hour, and it turned on after a small delay. So plan is for now to just let it turn on the extra hot water during the night, that way it can act as a small buffer to reduce the energy consumption during morning. The only thing still missing is the actual supply temperature for hc1, because unfortunately my heat pump does not provide this information to the gateway :(

Thank you for the update and all the work on this.

prj commented 2 years ago

Another thing I noticed:

        {
            "id": "/heatingCircuits/hc1/heatingCurveSetting",
            "type": "refEnum",
            "references": [
                {
                    "id": "/heatingCircuits/hc1/heatingCurveSetting/percentage",
                    "uri": "http://THERMOSTAT/heatingCircuits/hc1/heatingCurveSetting/percentage"
                },
                {
                    "id": "/heatingCircuits/hc1/heatingCurveSetting/increment",
                    "uri": "http://THERMOSTAT/heatingCircuits/hc1/heatingCurveSetting/increment"
                },
                {
                    "id": "/heatingCircuits/hc1/heatingCurveSetting/decrement",
                    "uri": "http://THERMOSTAT/heatingCircuits/hc1/heatingCurveSetting/decrement"
                }
            ]
        },

Increment and decrement are writeable, I have no idea what they do though.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.