ekutner / home-connect-hass

Alternative (and improved) Home Connect integration for Home Assistant
MIT License
491 stars 53 forks source link

Absolute time select entity missing #344

Closed joe-sydney closed 3 months ago

joe-sydney commented 4 months ago

Describe the bug

Thanks for taking up the suggestion on the "absolute time" feature. I tried this, but when I changed my config to Absolute Time, the old delay select entity was no longer available, but there was no new select entity to select the "absolute time". Perhaps I am missing something. See screenshot below.

image

Version of the custom_component

Configuration

Debug log

Paste the exception info here or attach the full log file
ekutner commented 4 months ago

There should be a new time control instead of the select, however it will only be created when the possibility to set a delayed start is made available by the api, so you have to have remote operation enabled and then select a program through HA.

kubasaw commented 4 months ago

I probably experienced the same issue. I think https://github.com/ekutner/home-connect-hass/blob/21b21de726a2f4b9361d70d5f5534e5fedf3b78f/custom_components/home_connect_alt/time.py#L132-L147 returns None instead of int.

In the logs I see that, there is HTTP404 from /api/homeappliances/ID/programs/active endpoint, but actual selected program may be get from /api/homeappliances/ID/programs/available. So if it is possible, there should be possible to get program delay time from its options.

2024-02-22 17:11:37.090 DEBUG (MainThread) [custom_components.home_connect_alt] Config entry *** is primary
2024-02-22 17:11:37.091 DEBUG (MainThread) [custom_components.home_connect_alt] OAuth2=*** api_host=https://api.home-connect.com
2024-02-22 17:11:37.091 DEBUG (MainThread) [custom_components.home_connect_alt] options: {'language': 'pl-PL', 'translation_mode': 'local', 'delayed_ops': 'absolute_time', 'log_mode': 7, 'name_template': '$appliance $name', 'sse_timeout': 15, 'appliance_settings': {'ID': {'name_template': 'Zmywarka $name'}}, 'entity_settings': {}}
2024-02-22 17:11:37.176 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances (try=1 count=1)

2024-02-22 17:11:37.425 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances (try=1 count=1) [200 OK] ====>
{
  "data": {
    "homeappliances": [{
      "brand": "Bosch",
      "connected": true,
      "enumber": "SPV4EMX16E/11",
      "haId": "ID",
      "name": "Zmywarka do naczyń",
      "type": "Dishwasher",
      "vib": "SPV4EMX16E"
    }]
  }
}

2024-02-22 17:11:37.428 DEBUG (MainThread) [home_connect_async.appliance] Starting to load appliance data for Zmywarka do naczyń (ID)
2024-02-22 17:11:37.428 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/selected (try=1 count=2)

2024-02-22 17:11:37.513 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/selected (try=1 count=2) [200 OK] ====>
{
  "data": {
    "constraints": {
      "access": "readWrite"
    },
    "key": "Dishcare.Dishwasher.Program.Eco50",
    "name": "Eco 50°",
    "options": [{
      "key": "BSH.Common.Option.StartInRelative",
      "value": 0,
      "unit": "seconds",
      "name": "Godzina rozpoczęcia"
    }, {
      "key": "Dishcare.Dishwasher.Option.IntensivZone",
      "value": false,
      "name": "Strefa intensywna"
    }, {
      "key": "Dishcare.Dishwasher.Option.VarioSpeedPlus",
      "value": false,
      "name": "SpeedPerfect+"
    }, {
      "key": "Dishcare.Dishwasher.Option.EcoDry",
      "value": true,
      "name": "EfficientDry"
    }, {
      "key": "Dishcare.Dishwasher.Option.SilenceOnDemand",
      "value": false,
      "name": "Wyciszenie"
    }, {
      "key": "BSH.Common.Option.RemainingProgramTime",
      "value": 12600,
      "unit": "seconds",
      "name": "Czas pozostały do zakończenia programu"
    }, {
      "key": "BSH.Common.Option.RemainingProgramTimeIsEstimated",
      "value": true,
      "name": "Szacowany pozostały czas trwania programu"
    }, {
      "key": "BSH.Common.Option.EnergyForecast",
      "value": 42,
      "unit": "%",
      "name": "Energia"
    }, {
      "key": "BSH.Common.Option.WaterForecast",
      "value": 52,
      "unit": "%",
      "name": "Woda"
    }]
  }
}

2024-02-22 17:11:37.537 DEBUG (MainThread) [home_connect_async.appliance] Loaded 9 Options for selected/Dishcare.Dishwasher.Program.Eco50
2024-02-22 17:11:37.538 DEBUG (MainThread) [home_connect_async.appliance] Loaded data for selected Program
2024-02-22 17:11:37.539 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/active (try=1 count=3)

2024-02-22 17:11:37.620 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/active (try=1 count=3) [404 Not Found] ====>
{
  "error": {
    "description": "There is no program active",
    "key": "SDK.Error.NoProgramActive"
  }
}

2024-02-22 17:11:37.621 DEBUG (MainThread) [home_connect_async.api] API call failed with code=404 error=SDK.Error.NoProgramActive
2024-02-22 17:11:37.622 DEBUG (MainThread) [home_connect_async.appliance] Failed to load active programs with error code=404 key=SDK.Error.NoProgramActive
2024-02-22 17:11:37.622 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/settings (try=1 count=4)

2024-02-22 17:11:37.696 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/settings (try=1 count=4) [200 OK] ====>
{
  "data": {
    "settings": [{
      "key": "BSH.Common.Setting.PowerState",
      "value": "BSH.Common.EnumType.PowerState.Off",
      "name": "Stan zasilania",
      "displayvalue": "Wyłączony"
    }]
  }
}

2024-02-22 17:11:37.697 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/settings/BSH.Common.Setting.PowerState (try=1 count=5)

2024-02-22 17:11:37.782 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/settings/BSH.Common.Setting.PowerState (try=1 count=5) [200 OK] ====>
{
  "data": {
    "name": "Stan zasilania",
    "key": "BSH.Common.Setting.PowerState",
    "constraints": {
      "allowedvalues": ["BSH.Common.EnumType.PowerState.Off", "BSH.Common.EnumType.PowerState.On"],
      "displayvalues": ["Wyłączony", "Włączony"],
      "access": "readWrite"
    },
    "type": "BSH.Common.EnumType.PowerState",
    "displayvalue": "Wyłączony",
    "value": "BSH.Common.EnumType.PowerState.Off"
  }
}

2024-02-22 17:11:37.787 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Settings
2024-02-22 17:11:37.788 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/status (try=1 count=6)

2024-02-22 17:11:37.910 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/status (try=1 count=6) [200 OK] ====>
{
  "data": {
    "status": [{
      "key": "BSH.Common.Status.RemoteControlStartAllowed",
      "value": true,
      "name": "Remote Start"
    }, {
      "key": "BSH.Common.Status.RemoteControlActive",
      "value": true,
      "name": "Zdalne sterowanie"
    }, {
      "key": "BSH.Common.Status.DoorState",
      "value": "BSH.Common.EnumType.DoorState.Open",
      "name": "Drzwiczki",
      "displayvalue": "Otwarty"
    }, {
      "key": "BSH.Common.Status.OperationState",
      "value": "BSH.Common.EnumType.OperationState.Ready",
      "name": "Stan wykonywanej czynności",
      "displayvalue": "Gotowy"
    }]
  }
}

2024-02-22 17:11:37.917 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Statuses
2024-02-22 17:11:37.923 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/commands (try=1 count=7)

2024-02-22 17:11:38.044 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/commands (try=1 count=7) [200 OK] ====>
{
  "data": {
    "commands": [{
      "key": "BSH.Common.Command.AcknowledgeEvent",
      "name": " OK"
    }]
  }
}

2024-02-22 17:11:38.045 DEBUG (MainThread) [home_connect_async.appliance] Loaded 1 Commands
2024-02-22 17:11:38.046 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/available (try=1 count=8)

2024-02-22 17:11:38.126 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/available (try=1 count=8) [200 OK] ====>
{
  "data": {
    "active": {
      "constraints": {
        "access": "read"
      }
    },
    "programs": [{
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.Intensiv70",
      "name": "Intensywny 70°"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.Auto2",
      "name": "Auto 45-65°"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.Eco50",
      "name": "Eco 50°"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.PreRinse",
      "name": "Płukanie wstępne"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.NightWash",
      "name": "Nocny 50"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.Quick65",
      "name": "Express 65° - 1h"
    }, {
      "constraints": {
        "execution": "selectandstart"
      },
      "key": "Dishcare.Dishwasher.Program.MachineCare",
      "name": "Czyszczenie zmywarki"
    }],
    "selected": {
      "constraints": {
        "access": "readWrite"
      },
      "key": "Dishcare.Dishwasher.Program.Eco50",
      "name": "Eco 50°",
      "options": [{
        "key": "BSH.Common.Option.StartInRelative",
        "value": 0,
        "unit": "seconds",
        "name": "Godzina rozpoczęcia"
      }, {
        "key": "Dishcare.Dishwasher.Option.IntensivZone",
        "value": false,
        "name": "Strefa intensywna"
      }, {
        "key": "Dishcare.Dishwasher.Option.VarioSpeedPlus",
        "value": false,
        "name": "SpeedPerfect+"
      }, {
        "key": "Dishcare.Dishwasher.Option.EcoDry",
        "value": true,
        "name": "EfficientDry"
      }, {
        "key": "Dishcare.Dishwasher.Option.SilenceOnDemand",
        "value": false,
        "name": "Wyciszenie"
      }, {
        "key": "BSH.Common.Option.RemainingProgramTime",
        "value": 12600,
        "unit": "seconds",
        "name": "Czas pozostały do zakończenia programu"
      }, {
        "key": "BSH.Common.Option.RemainingProgramTimeIsEstimated",
        "value": true,
        "name": "Szacowany pozostały czas trwania programu"
      }, {
        "key": "BSH.Common.Option.EnergyForecast",
        "value": 42,
        "unit": "%",
        "name": "Energia"
      }, {
        "key": "BSH.Common.Option.WaterForecast",
        "value": 52,
        "unit": "%",
        "name": "Woda"
      }]
    }
  }
}

2024-02-22 17:11:38.128 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/available/Dishcare.Dishwasher.Program.Eco50 (try=1 count=9)

2024-02-22 17:11:38.219 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/ID/programs/available/Dishcare.Dishwasher.Program.Eco50 (try=1 count=9) [200 OK] ====>
{
  "data": {
    "key": "Dishcare.Dishwasher.Program.Eco50",
    "name": "Eco 50°",
    "options": [{
      "name": "Godzina rozpoczęcia",
      "key": "BSH.Common.Option.StartInRelative",
      "constraints": {
        "min": 0,
        "max": 86400
      },
      "unit": "seconds",
      "type": "Int"
    }, {
      "key": "Dishcare.Dishwasher.Option.IntensivZone",
      "type": "Boolean",
      "constraints": {
        "default": false,
        "liveupdate": true
      },
      "name": "Strefa intensywna"
    }, {
      "key": "Dishcare.Dishwasher.Option.VarioSpeedPlus",
      "type": "Boolean",
      "constraints": {
        "default": false,
        "liveupdate": true
      },
      "name": "SpeedPerfect+"
    }, {
      "key": "Dishcare.Dishwasher.Option.EcoDry",
      "type": "Boolean",
      "constraints": {
        "default": false,
        "liveupdate": true
      },
      "name": "EfficientDry"
    }]
  }
}

2024-02-22 17:11:38.231 DEBUG (MainThread) [home_connect_async.appliance] Loaded 4 Options for available/Dishcare.Dishwasher.Program.Eco50
2024-02-22 17:11:38.234 DEBUG (MainThread) [home_connect_async.appliance] Loaded 7 available Programs
2024-02-22 17:11:38.235 DEBUG (MainThread) [home_connect_async.appliance] Finished loading appliance data for Zmywarka do naczyń (ID)
2024-02-22 17:11:38.235 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PAIRED = None
2024-02-22 17:11:38.270 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'ID_bsh_common_status_remotecontrolactive', 'ID_dishcare_dishwasher_option_intensivzone', 'ID_dishcare_dishwasher_option_ecodry', 'ID_dishcare_dishwasher_option_silenceondemand', 'ID_dishcare_dishwasher_option_variospeedplus', 'ID_bsh_common_status_doorstate', 'ID_bsh_common_option_remainingprogramtimeisestimated', 'ID_connected', 'ID_bsh_common_status_remotecontrolstartallowed'}
2024-02-22 17:11:38.273 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'ID_dishcare_dishwasher_option_intensivzone', 'ID_bsh_common_setting_powerstate', 'ID_dishcare_dishwasher_option_ecodry', 'ID_dishcare_dishwasher_option_variospeedplus'}
2024-02-22 17:11:38.277 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'ID_programs'}
2024-02-22 17:11:38.295 WARNING (MainThread) [home_connect_async.callback_registery] Unhandled exception in callback function for event_key: Events.PAIRED
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/home_connect_async/callback_registery.py", line 156, in _async_call
    callback(appliance)
  File "/config/custom_components/home_connect_alt/time.py", line 32, in add_appliance
    device = DelayedOperationTime(appliance, option.key, conf, option)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 57, in __init__
    self._current:time = self.init_time()
                         ^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 130, in init_time
    return self.adjust_time(t, False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 104, in adjust_time
    if endtime < now + timedelta(seconds=program_run_time):
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported type for timedelta seconds component: NoneType
2024-02-22 17:11:38.357 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.363 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'ID_bsh_common_option_remainingprogramtime', 'ID_bsh_common_option_energyforecast', 'ID_bsh_common_setting_powerstate', 'ID_bsh_common_option_waterforecast', 'ID_bsh_common_status_operationstate', 'ID_bsh_common_option_startinrelative', 'ID_selected_program'}
2024-02-22 17:11:38.367 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'ID_start_pause', 'ID_stop'}
2024-02-22 17:11:38.368 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2024-02-22 17:11:38.370 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.372 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.375 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.376 WARNING (MainThread) [home_connect_async.callback_registery] Unhandled exception in callback function for event_key: Events.DATA_CHANGED
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/home_connect_async/callback_registery.py", line 156, in _async_call
    callback(appliance)
  File "/config/custom_components/home_connect_alt/time.py", line 32, in add_appliance
    device = DelayedOperationTime(appliance, option.key, conf, option)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 57, in __init__
    self._current:time = self.init_time()
                         ^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 130, in init_time
    return self.adjust_time(t, False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 104, in adjust_time
    if endtime < now + timedelta(seconds=program_run_time):
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: unsupported type for timedelta seconds component: NoneType
2024-02-22 17:11:38.403 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.405 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.407 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-02-22 17:11:38.407 DEBUG (MainThread) [home_connect_async.homeconnect] Loadded appliance: Zmywarka do naczyń
2024-02-22 17:11:38.412 DEBUG (MainThread) [home_connect_async.homeconnect] Connecting to SSE stream
2024-02-22 17:11:38.480 DEBUG (MainThread) [custom_components.home_connect_alt.select] Current selected program is Dishcare.Dishwasher.Program.Eco50
ekutner commented 4 months ago

please attach the complete log file

kubasaw commented 4 months ago

In the attachment there is Debug Log from the component. appliances->ID->active_program is set as null, thus condition:

https://github.com/ekutner/home-connect-hass/blob/21b21de726a2f4b9361d70d5f5534e5fedf3b78f/custom_components/home_connect_alt/time.py#L136

is not met, and get_program_run_time returns None causing Error shown before

{
  "appliances": {
    "ID": {
      "name": "Zmywarka do naczy\u0144",
      "brand": "Bosch",
      "vib": "SPV4EMX16E",
      "connected": true,
      "type": "Dishwasher",
      "enumber": "SPV4EMX16E/11",
      "haId": "ID",
      "uri": "/api/homeappliances/ID",
      "available_programs": {
        "Dishcare.Dishwasher.Program.Intensiv70": {
          "key": "Dishcare.Dishwasher.Program.Intensiv70",
          "name": "Intensywny 70\u00b0",
          "options": null,
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.Auto2": {
          "key": "Dishcare.Dishwasher.Program.Auto2",
          "name": "Auto 45-65\u00b0",
          "options": null,
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.Eco50": {
          "key": "Dishcare.Dishwasher.Program.Eco50",
          "name": "Eco 50\u00b0",
          "options": {
            "BSH.Common.Option.StartInRelative": {
              "key": "BSH.Common.Option.StartInRelative",
              "value": null,
              "type": "Int",
              "name": "Godzina rozpocz\u0119cia",
              "unit": "seconds",
              "displayvalue": null,
              "min": 0,
              "max": 86400,
              "stepsize": null,
              "allowedvalues": null,
              "allowedvaluesdisplay": null,
              "execution": null,
              "liveupdate": null,
              "default": null,
              "access": null
            },
            "Dishcare.Dishwasher.Option.IntensivZone": {
              "key": "Dishcare.Dishwasher.Option.IntensivZone",
              "value": null,
              "type": "Boolean",
              "name": "Strefa intensywna",
              "unit": null,
              "displayvalue": null,
              "min": null,
              "max": null,
              "stepsize": null,
              "allowedvalues": null,
              "allowedvaluesdisplay": null,
              "execution": null,
              "liveupdate": true,
              "default": false,
              "access": null
            },
            "Dishcare.Dishwasher.Option.VarioSpeedPlus": {
              "key": "Dishcare.Dishwasher.Option.VarioSpeedPlus",
              "value": null,
              "type": "Boolean",
              "name": "SpeedPerfect+",
              "unit": null,
              "displayvalue": null,
              "min": null,
              "max": null,
              "stepsize": null,
              "allowedvalues": null,
              "allowedvaluesdisplay": null,
              "execution": null,
              "liveupdate": true,
              "default": false,
              "access": null
            },
            "Dishcare.Dishwasher.Option.EcoDry": {
              "key": "Dishcare.Dishwasher.Option.EcoDry",
              "value": null,
              "type": "Boolean",
              "name": "EfficientDry",
              "unit": null,
              "displayvalue": null,
              "min": null,
              "max": null,
              "stepsize": null,
              "allowedvalues": null,
              "allowedvaluesdisplay": null,
              "execution": null,
              "liveupdate": true,
              "default": false,
              "access": null
            }
          },
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.PreRinse": {
          "key": "Dishcare.Dishwasher.Program.PreRinse",
          "name": "P\u0142ukanie wst\u0119pne",
          "options": null,
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.NightWash": {
          "key": "Dishcare.Dishwasher.Program.NightWash",
          "name": "Nocny 50",
          "options": null,
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.Quick65": {
          "key": "Dishcare.Dishwasher.Program.Quick65",
          "name": "Express 65\u00b0 - 1h",
          "options": null,
          "execution": "selectandstart",
          "active": false
        },
        "Dishcare.Dishwasher.Program.MachineCare": {
          "key": "Dishcare.Dishwasher.Program.MachineCare",
          "name": "Czyszczenie zmywarki",
          "options": null,
          "execution": "selectandstart",
          "active": false
        }
      },
      "active_program": null,
      "selected_program": {
        "key": "Dishcare.Dishwasher.Program.Eco50",
        "name": "Eco 50\u00b0",
        "options": {
          "BSH.Common.Option.StartInRelative": {
            "key": "BSH.Common.Option.StartInRelative",
            "value": 0,
            "type": null,
            "name": "Godzina rozpocz\u0119cia",
            "unit": "seconds",
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "Dishcare.Dishwasher.Option.IntensivZone": {
            "key": "Dishcare.Dishwasher.Option.IntensivZone",
            "value": false,
            "type": null,
            "name": "Strefa intensywna",
            "unit": null,
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "Dishcare.Dishwasher.Option.VarioSpeedPlus": {
            "key": "Dishcare.Dishwasher.Option.VarioSpeedPlus",
            "value": false,
            "type": null,
            "name": "SpeedPerfect+",
            "unit": null,
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "Dishcare.Dishwasher.Option.EcoDry": {
            "key": "Dishcare.Dishwasher.Option.EcoDry",
            "value": true,
            "type": null,
            "name": "EfficientDry",
            "unit": null,
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "Dishcare.Dishwasher.Option.SilenceOnDemand": {
            "key": "Dishcare.Dishwasher.Option.SilenceOnDemand",
            "value": false,
            "type": null,
            "name": "Wyciszenie",
            "unit": null,
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "BSH.Common.Option.RemainingProgramTime": {
            "key": "BSH.Common.Option.RemainingProgramTime",
            "value": 12600,
            "type": null,
            "name": "Czas pozosta\u0142y do zako\u0144czenia programu",
            "unit": "seconds",
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "BSH.Common.Option.RemainingProgramTimeIsEstimated": {
            "key": "BSH.Common.Option.RemainingProgramTimeIsEstimated",
            "value": true,
            "type": null,
            "name": "Szacowany pozosta\u0142y czas trwania programu",
            "unit": null,
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "BSH.Common.Option.EnergyForecast": {
            "key": "BSH.Common.Option.EnergyForecast",
            "value": 42,
            "type": null,
            "name": "Energia",
            "unit": "%",
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          },
          "BSH.Common.Option.WaterForecast": {
            "key": "BSH.Common.Option.WaterForecast",
            "value": 52,
            "type": null,
            "name": "Woda",
            "unit": "%",
            "displayvalue": null,
            "min": null,
            "max": null,
            "stepsize": null,
            "allowedvalues": null,
            "allowedvaluesdisplay": null,
            "execution": null,
            "liveupdate": null,
            "default": null,
            "access": null
          }
        },
        "execution": null,
        "active": false
      },
      "status": {
        "BSH.Common.Status.RemoteControlStartAllowed": {
          "key": "BSH.Common.Status.RemoteControlStartAllowed",
          "value": true,
          "name": "Remote Start",
          "displayvalue": null,
          "unit": null
        },
        "BSH.Common.Status.RemoteControlActive": {
          "key": "BSH.Common.Status.RemoteControlActive",
          "value": true,
          "name": "Zdalne sterowanie",
          "displayvalue": null,
          "unit": null
        },
        "BSH.Common.Status.DoorState": {
          "key": "BSH.Common.Status.DoorState",
          "value": "BSH.Common.EnumType.DoorState.Open",
          "name": "Drzwiczki",
          "displayvalue": "Otwarty",
          "unit": null
        },
        "BSH.Common.Status.OperationState": {
          "key": "BSH.Common.Status.OperationState",
          "value": "BSH.Common.EnumType.OperationState.Ready",
          "name": "Stan wykonywanej czynno\u015bci",
          "displayvalue": "Gotowy",
          "unit": null
        }
      },
      "settings": {
        "BSH.Common.Setting.PowerState": {
          "key": "BSH.Common.Setting.PowerState",
          "value": "BSH.Common.EnumType.PowerState.Off",
          "type": "BSH.Common.EnumType.PowerState",
          "name": "Stan zasilania",
          "unit": null,
          "displayvalue": "Wy\u0142\u0105czony",
          "min": null,
          "max": null,
          "stepsize": null,
          "allowedvalues": [
            "BSH.Common.EnumType.PowerState.Off",
            "BSH.Common.EnumType.PowerState.On"
          ],
          "allowedvaluesdisplay": [
            "Wy\u0142\u0105czony",
            "W\u0142\u0105czony"
          ],
          "execution": null,
          "liveupdate": null,
          "default": null,
          "access": "readWrite"
        }
      },
      "commands": {
        "BSH.Common.Command.AcknowledgeEvent": {
          "key": "BSH.Common.Command.AcknowledgeEvent",
          "name": " OK"
        }
      },
      "startonly_options": null,
      "startonly_program": null,
      "_active_program_fail_count": 0
    }
  },
  "_disabled_appliances": [],
  "_sse_timeout": 15
}
ekutner commented 4 months ago

Thanks. Try 1.1.2 and see if it works better but it may take a few more iteration because I don't have the appliances to test it myself. If there is still an issue I need the entire debug log file. See instructions in the README how to enable it.

mr-p666 commented 4 months ago

Thank you very much for your effort! :+1: Unfortunately the absolut time for the delayed start still doesn't work. Hopefully the attached log file helps! home-assistant_home_connect_alt_2024-02-24T10-05-45.581Z.log

ekutner commented 4 months ago

Try version 1.1.3, it should fix that issue.

mr-p666 commented 4 months ago

You did it! :smiley: image Thanks a lot!

ekutner commented 4 months ago

Great, now it actually needs to work

mr-p666 commented 4 months ago

I encountered two problems:

ekutner commented 4 months ago

log of the error please what do you mean no possibility to create automation?

mr-p666 commented 3 months ago

Sorry, it was a bad idea to write the comment without being able to provide relevant information. That's the error message in the browser: Bildschirmfoto vom 2024-03-08 16-31-32 And here is the logfile:

2024-03-08 16:30:55.003 DEBUG (MainThread) [home_connect_async.api] 
HTTP PUT /api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState (try=1 count=9)
{
  "data": {
    "key": "BSH.Common.Setting.PowerState",
    "value": "BSH.Common.EnumType.PowerState.On"
  }
}

2024-03-08 16:30:57.001 DEBUG (MainThread) [home_connect_async.api] HTTP PUT /api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState (try=1 count=9) [204]
2024-03-08 16:30:57.006 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"012050390647002214","items":[{"displayvalue":"An","handling":"none","key":"BSH.Common.Setting.PowerState","level":"hint","name":"Energiezustand","timestamp":1709911856,"uri":"/api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState","value":"BSH.Common.EnumType.PowerState.On"}]}', origin='https://api.home-connect.com', last_event_id='012050390647002214')
2024-03-08 16:30:57.007 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Setting.PowerState = BSH.Common.EnumType.PowerState.On
2024-03-08 16:31:03.871 DEBUG (MainThread) [home_connect_async.api] 
HTTP PUT /api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState (try=1 count=10)
{
  "data": {
    "key": "BSH.Common.Setting.PowerState",
    "value": "BSH.Common.EnumType.PowerState.Off"
  }
}

2024-03-08 16:31:04.533 DEBUG (MainThread) [home_connect_async.api] HTTP PUT /api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState (try=1 count=10) [204]
2024-03-08 16:31:04.536 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"012050390647002214","items":[{"displayvalue":"Aus","handling":"none","key":"BSH.Common.Setting.PowerState","level":"hint","name":"Energiezustand","timestamp":1709911864,"uri":"/api/homeappliances/012050390647002214/settings/BSH.Common.Setting.PowerState","value":"BSH.Common.EnumType.PowerState.Off"}]}', origin='https://api.home-connect.com', last_event_id='012050390647002214')
2024-03-08 16:31:04.536 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Setting.PowerState = BSH.Common.EnumType.PowerState.Off
2024-03-08 16:31:07.945 DEBUG (MainThread) [home_connect_async.api] 
HTTP PUT /api/homeappliances/012050390647002214/programs/selected (try=1 count=11)
{
  "data": {
    "key": "Dishcare.Dishwasher.Program.Auto2",
    "options": []
  }
}

2024-03-08 16:31:08.851 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='NOTIFY', message='NOTIFY', data='{"haId":"012050390647002214","items":[{"displayvalue":"Auto 45-65°","handling":"none","key":"BSH.Common.Root.SelectedProgram","level":"hint","timestamp":1709911868,"uri":"/api/homeappliances/012050390647002214/programs/selected","value":"Dishcare.Dishwasher.Program.Auto2"},{"handling":"none","key":"BSH.Common.Option.RemainingProgramTime","level":"hint","name":"Verbleibende Programmlaufzeit","timestamp":1709911868,"unit":"seconds","uri":"/api/homeappliances/012050390647002214/programs/selected/options/BSH.Common.Option.RemainingProgramTime","value":8400}]}', origin='https://api.home-connect.com', last_event_id='012050390647002214')
2024-03-08 16:31:09.837 DEBUG (MainThread) [home_connect_async.api] HTTP PUT /api/homeappliances/012050390647002214/programs/selected (try=1 count=11) [204]
2024-03-08 16:31:09.837 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/012050390647002214/programs/selected (try=1 count=12)

2024-03-08 16:31:09.899 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/012050390647002214/programs/selected (try=1 count=12) [200]
2024-03-08 16:31:09.902 DEBUG (MainThread) [home_connect_async.appliance] Loaded 10 Options for selected/Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:09.902 DEBUG (MainThread) [home_connect_async.appliance] Loaded data for selected Program
2024-03-08 16:31:09.902 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/012050390647002214/programs/available (try=1 count=13)

2024-03-08 16:31:09.966 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/012050390647002214/programs/available (try=1 count=13) [200]
2024-03-08 16:31:09.967 DEBUG (MainThread) [home_connect_async.api] 
HTTP GET /api/homeappliances/012050390647002214/programs/available/Dishcare.Dishwasher.Program.Auto2 (try=1 count=14)

2024-03-08 16:31:10.019 DEBUG (MainThread) [home_connect_async.api] HTTP GET /api/homeappliances/012050390647002214/programs/available/Dishcare.Dishwasher.Program.Auto2 (try=1 count=14) [200]
2024-03-08 16:31:10.020 DEBUG (MainThread) [home_connect_async.appliance] Loaded 5 Options for available/Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:10.020 DEBUG (MainThread) [home_connect_async.appliance] Loaded 8 available Programs
2024-03-08 16:31:10.020 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.PROGRAM_SELECTED = Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:10.021 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'012050390647002214_dishcare_dishwasher_option_intensivzone', '012050390647002214_dishcare_dishwasher_option_brilliancedry', '012050390647002214_dishcare_dishwasher_option_hygieneplus'}
2024-03-08 16:31:10.027 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'012050390647002214_bsh_common_option_energyforecast', '012050390647002214_bsh_common_option_waterforecast'}
2024-03-08 16:31:10.040 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.041 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.042 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'012050390647002214_dishcare_dishwasher_option_intensivzone', '012050390647002214_dishcare_dishwasher_option_brilliancedry', '012050390647002214_dishcare_dishwasher_option_hygieneplus', '012050390647002214_dishcare_dishwasher_option_variospeedplus'}
2024-03-08 16:31:10.046 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.049 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: {'012050390647002214_bsh_common_option_startinrelative'}
2024-03-08 16:31:10.061 DEBUG (MainThread) [custom_components.home_connect_alt.sensor] Updating sensor 012050390647002214_selected_program => Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:10.067 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: Events.DATA_CHANGED = None
2024-03-08 16:31:10.068 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.068 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.069 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.069 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.069 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.070 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.070 DEBUG (MainThread) [custom_components.home_connect_alt.common] Registering new entities: set()
2024-03-08 16:31:10.075 DEBUG (MainThread) [custom_components.home_connect_alt.sensor] Updating sensor 012050390647002214_selected_program => Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:10.084 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Root.SelectedProgram = Dishcare.Dishwasher.Program.Auto2
2024-03-08 16:31:10.084 DEBUG (MainThread) [home_connect_async.callback_registery] Broadcasting event: BSH.Common.Option.RemainingProgramTime = 8400
2024-03-08 16:31:14.323 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139707980174016] unsupported operand type(s) for /: 'float' and 'NoneType'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/time/__init__.py", line 41, in _async_set_value
    return await entity.async_set_value(service_call.data[ATTR_TIME])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 81, in async_set_value
    self._current = self.adjust_time(value, True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 129, in adjust_time
    delay = int(delay/stepsize)*stepsize
                ~~~~~^~~~~~~~~
TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'
2024-03-08 16:31:14.807 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139707980174016] unsupported operand type(s) for /: 'float' and 'NoneType'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2319, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2356, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 905, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 975, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/time/__init__.py", line 41, in _async_set_value
    return await entity.async_set_value(service_call.data[ATTR_TIME])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 81, in async_set_value
    self._current = self.adjust_time(value, True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/home_connect_alt/time.py", line 129, in adjust_time
    delay = int(delay/stepsize)*stepsize
                ~~~~~^~~~~~~~~
TypeError: unsupported operand type(s) for /: 'float' and 'NoneType'
2024-03-08 16:31:17.439 DEBUG (MainThread) [home_connect_async.homeconnect] Received event from SSE stream: MessageEvent(type='KEEP-ALIVE', message='KEEP-ALIVE', data='', origin='https://api.home-connect.com', last_event_id='012050390647002214')

Regarding automation: There is no option to use delayed start in the action part if it's configured with absolute time. When configured with 'Use delay time span' I can select a relative time in the future in the action part. image

ekutner commented 3 months ago

Version 1.1.4 should fix the above error. As for the automation, it's not clear to me exactly what you're doing there and being and German doesn't help. Anyway, it doesn't look like you're doing it right. You should use the time.set_value service to set the time for this entity. Here is an example in YAML, which you can convert to UI as well.

service: time.set_value
metadata: {}
data:
  time: "10:53:00"
target:
  entity_id: time.bosch_wat286h0gb_68a40e3587eb_bsh_common_option_finishinrelative
mr-p666 commented 3 months ago

Thank you for the quick solution and the tip about the time service. I expected it to work the same way as with the relative time option. :+1:

There's just one thing left that's a little unfortunate. The times entered in the home connect app for the dishwasher are start times. The times displayed in HA also suggested start times (translated to German as 'Startzeit' in the device overview as also as entity_id in the action part of my automation (...startinrelative). image image Only in your example above I see an end time (...finishinrelative) instead, which is actually the time I can configure as an incorrect start time. Do you see a way to use the time used as the start time instead of the end time?

Thank you very much for your time and efforts!

ekutner commented 3 months ago

Yes, it can get confusing. Some appliances, like washing machines, have a setting for the finish time while other appliances, like dish washers, have a setting for start time. Regardless of the available setting in the API the HA time control exposed by the integration will always set the end time of the program. It becomes confusing because the name and ID of the entity comes from the underlying setting available through the API. I'm not sure what would be the best way to resolve that and it's the reason I made it optional, so people have to explicitly enable it and hopefully if they do they understand how it works. I'm open to suggestions how to improve it.

mr-p666 commented 3 months ago

Thanks a lot for your support. I now automatically shift the time back by two and a half hours and use this to get an approximate start time. But of course this is not a general solution if you could set a definable time offset, as the times of the programs are often different. It would be important that the misleading labels with start time are always labeled as end time if the API always uses the end time.

ekutner commented 3 months ago

I'm sorry but I don't understand why you have to do any calculations. If you enable the absolute time option then the time entity always shows the absolute end time of the program, regardless of what the API supports and regardless of the name of the entity.

mr-p666 commented 3 months ago

Yes, that seems a bit strange at first. But in the end it's the automation I'm using it for a dynamic electricity tariff. I use the cheapest two hours of the night or day to run the dishwasher and it would defeat the purpose if the washing program is just finishing at the start of the cheapest time. :wink:

ekutner commented 3 months ago

Again, I don't follow. If you want the default API behavior (setting the start delay for the dishwasher) then don't enable this option. If you want to use the absolute time then the simplest approach would be to just set it to 3 hours after the start of the night rate so you know the program is sure to start within that rate.

mr-p666 commented 3 months ago

Yes, that's exactly what I said... :wink: [...]I now automatically move the time back by two and a half hours and get an approximate start time from this. [...] Works great for me. Thank you for your support! :+1: @joe-sydney I think, it's time to close this issue.

joe-sydney commented 3 months ago

I've tested this and it works as expected... both the default option as well as the absolute time option. With regard to using the dishwasher at the cheapest time of the day, that is actually what I would use it for, we set the end time to the an appropriate time within the off peak rates, and the integration now works out the start time based on the selected program (i.e., no need to work out the start time delay anymore.

I still can't use this fully yet as I have yet to figure out a way to set the time entity via integration (rather then manual input - I use physical as well as HA buttons to start specific programs that end at a certain time). I think HA currently doesn't offer a service call to set the value of the time entity, but this is not related to the original issue. I think I have a workaround with a python script to set the state value of the time entity (or any entity for that matter), but will test that later.

Will close this issue.