CFenner / PyViCare

Python Library to access Viessmann ViCare API
Apache License 2.0
2 stars 1 forks source link

expose hysteresis values #18

Open CFenner opened 3 months ago

CFenner commented 3 months ago

Expose

https://github.com/home-assistant/core/issues/123569#issuecomment-2291167861

fyi @ignazhabibi


      {
          "properties": {
              "value": {
                  "value": 5,
                  "unit": "kelvin",
                  "type": "number"
              },
              "switchOnValue": {
                  "value": 5,
                  "unit": "kelvin",
                  "type": "number"
              },
              "switchOffValue": {
                  "value": 5,
                  "unit": "kelvin",
                  "type": "number"
              }
          },
          "commands": {
              "setHysteresis": {
                  "uri": "https://api.viessmann.com/iot/v1/equipment/installations/XXXXXX/gateways/XXXXXX/devices/0/features/heating.dhw.temperature.hysteresis/commands/setHysteresis",
                  "name": "setHysteresis",
                  "isExecutable": true,
                  "params": {
                      "hysteresis": {
                          "type": "number",
                          "required": true,
                          "constraints": {
                              "min": 1,
                              "max": 10,
                              "stepping": 0.5
                          }
                      }
                  }
              },
              "setHysteresisSwitchOnValue": {
                  "uri": "https://api.viessmann.com/iot/v1/equipment/installations/XXXXXX/gateways/XXXXXX/devices/0/features/heating.dhw.temperature.hysteresis/commands/setHysteresisSwitchOnValue",
                  "name": "setHysteresisSwitchOnValue",
                  "isExecutable": true,
                  "params": {
                      "hysteresis": {
                          "type": "number",
                          "required": true,
                          "constraints": {
                              "min": 1,
                              "max": 10,
                              "stepping": 0.5
                          }
                      }
                  }
              },
              "setHysteresisSwitchOffValue": {
                  "uri": "https://api.viessmann.com/iot/v1/equipment/installations/XXXXXX/gateways/XXXXXX/devices/0/features/heating.dhw.temperature.hysteresis/commands/setHysteresisSwitchOffValue",
                  "name": "setHysteresisSwitchOffValue",
                  "isExecutable": true,
                  "params": {
                      "hysteresis": {
                          "type": "number",
                          "required": true,
                          "constraints": {
                              "min": 1,
                              "max": 10,
                              "stepping": 0.5
                          }
                      }
                  }
              }
          },
          "apiVersion": 1,
          "uri": "https://api.viessmann.com/iot/v1/equipment/installations/XXXXXX/gateways/XXXXXX/devices/0/features/heating.dhw.temperature.hysteresis",
          "gatewayId": "XXXXXX",
          "feature": "heating.dhw.temperature.hysteresis",
          "timestamp": "2023-05-11T14:01:17.221Z",
          "isEnabled": true,
          "isReady": true,
          "deviceId": "0"
      },
CFenner commented 2 months ago

@ignazhabibi there are three values with the ability to change them: hysteresis, hysteresis switch on value and hysteresis switch off value. What would you need to see / control?

ignazhabibi commented 2 months ago

In my case (Vitocal 250-A) I can see and change switchOn and switchOff value in ViGuide. Most important to me is switchOn which means only start water heating when current value is „5“ K below. However, someone else may also need the other values, I don‘t know.

IMG_0789

ignazhabibi commented 2 months ago

Another feature request: Change operating mode (off, eco, comfort) of the water heater. With this the whole feature set would be available.

heating.dhw.operating.modes.active

Shows the current active operating mode of the DHW and provides a command to change the operating mode

CFenner commented 2 months ago

@ignazhabibi Would you mind testing this in the HA integration?

https://github.com/home-assistant/core/pull/124294

I added three entities: switchOn, switchOff and hysteresis If we don't need hysteresis and the other ones are enough I would like to remove it.

ignazhabibi commented 2 months ago

Of course I will help testing

CFenner commented 2 months ago

You can use https://gist.github.com/bdraco/43f8043cb04b9838383fd71353e99b18 to test the PR:

curl -o- -L https://gist.githubusercontent.com/bdraco/43f8043cb04b9838383fd71353e99b18/raw/core_integration_pr | bash /dev/stdin -d vicare -p 124294
ignazhabibi commented 2 months ago

switchOn and switchOff work as expected. When changing switchOn it also changes the pure hysteresis value. So in my installation this seems to be identical and the pure hysteresis value can be removed.

ignazhabibi commented 2 months ago

I guess that other installations (not E3) only have hysteresis and no dedicated switchOn and switchOff values. But I can't test this.

CFenner commented 2 months ago

Done, maybe you can give your 👍 on the PR.