Home Connect

Hey Marc,
Here it comes

It is a precondition that you ha installed custom:button-card

The device representing my dishwasher is called opvaskemaskine so you need to replace that in my code by the name of your machine

Then here is some code to be placed in the switch section of your configuration.yaml. if you don’t have a switch section already you can creat that by adding the line

Switch:

Then add the following code right after:

##################################################################################################################
####################                        VWashing machinne                        ####################
##################################################################################################################
  - platform: template
    switches:
      opvaskemaskine_program_chosen:
        value_template: >
          {{ 
          is_state('switch.opvaskemaskine_program_intensiv70', 'on') or 
          is_state('switch.opvaskemaskine_program_auto2', 'on') or 
          is_state('switch.opvaskemaskine_program_eco50', 'on') or 
          is_state('switch.opvaskemaskine_program_nightwash', 'on') or 
          is_state('switch.opvaskemaskine_program_kurz60', 'on') or 
          is_state('switch.opvaskemaskine_program_glas40', 'on') or 
          is_state('switch.opvaskemaskine_program_quick45', 'on') or 
          is_state('switch.opvaskemaskine_program_machinecare', 'on') 
          }}
        ############  The following program entities are not used  ##############
        #   is_state('switch.opvaskemaskine_program_auto1', 'on') or  
        #   is_state('switch.opvaskemaskine_program_auto3', 'on') or 
        #   is_state('switch.opvaskemaskine_program_autohalfload', 'on') or 
        #   is_state('switch.opvaskemaskine_program_expresssparkle65', 'on') or
        #   is_state('switch.opvaskemaskine_program_glasscare', 'on') or 
        #   is_state('switch.opvaskemaskine_program_intensiv45', 'on') or 
        #   is_state('switch.opvaskemaskine_program_intensivpower', 'on') or
        #   is_state('switch.opvaskemaskine_program_magicdaily', 'on') or 
        #   is_state('switch.opvaskemaskine_program_maximumcleaning', 'on') or
        #   is_state('switch.opvaskemaskine_program_normal45', 'on') or 
        #   is_state('switch.opvaskemaskine_program_normal65', 'on') or
        #   is_state('switch.opvaskemaskine_program_quick65', 'on') or 
        #   is_state('switch.opvaskemaskine_program_steamfresh', 'on') or
        #   is_state('switch.opvaskemaskine_program_super60', 'on') or 
        turn_on:
        turn_off:
      opvaskemaskine_ready_for_program_activation:
        value_template: >
          {{ is_state('switch.opvaskemaskine_power', 'on') and 
          is_state('binary_sensor.opvaskemaskine_door', 'off') and 
          is_state('switch.opvaskemaskine_program_chosen', 'off')}}
        turn_on:
        turn_off:
      opvaskemaskine_program_active:
        value_template: >
          {{ is_state('switch.opvaskemaskine_program_chosen', 'on') and 
          is_state('binary_sensor.opvaskemaskine_door', 'off')}}
        turn_on:
        turn_off:

then create a lovelace card and replace its code by the following

cards:
  - card:
      type: vertical-stack
      cards:
        - type: button
          tap_action:
            action: toggle
          entity: switch.opvaskemaskine_power
          icon_height: 40px
          show_name: false
        - cards:
            - entity: switch.opvaskemaskine_program_intensiv70
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_auto2
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_eco50
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_nightwash
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_kurz60
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_glas40
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_quick45
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
            - entity: switch.opvaskemaskine_program_machinecare
              hold_action:
                action: more-info
              icon_height: 40px
              show_icon: true
              show_name: true
              tap_action:
                action: toggle
              type: button
          type: grid
          columns: 4
          square: false
    conditions:
      - entity: switch.opvaskemaskine_ready_for_program_activation
        state: 'on'
    type: conditional
  - card:
      type: 'custom:button-card'
      aspect_ratio: 3/4
      entity: binary_sensor.opvaskemaskine_door
      tap_action:
        action: call-service
        service: switch.toggle
        service_data:
          entity_id: switch.opvaskemaskine_power
      show_entity_picture: true
      name: '  '
      show_state: false
      size: 130%
      custom_fields:
        power: |
          [[[
            if (states['switch.opvaskemaskine_power'].state == 'on')
              return `<ha-icon
                icon= "mdi:power"
                style="width: 40px; height: 40px; color: red;">
                </ha-icon>`
            else
              return `<ha-icon
                icon= "mdi:power"
                style="width: 40px; height: 40px; color: gray;">
                </ha-icon>`
          ]]]
        finish_time: |
          [[[ 
            if (states['switch.opvaskemaskine_program_active'].state == 'on')
            {
              var hour = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(11,2));;
              hour = hour + 1;
              if (hour > 23)
                hour = hour - 23;  
              var minute = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(14,2));
              var second = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(17,2));
              if (second > 30)
                minute = minute + 1;
              if (minute > 59)
              {
                minute = minute - 59;
                hour = hour + 1;
              }
              return hour + ':' + minute;
            }
            else
              return '';
          ]]]
        program: |
          [[[ 
            if (states['binary_sensor.opvaskemaskine_door'].state == 'on')
              return '';
            else if (states['switch.opvaskemaskine_program_intensiv70'].state == 'on')
              return `<ha-icon
                icon= "mdi:pot"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Intensiv 70°C (S 7 6 2:20)`
            else if (states['switch.opvaskemaskine_program_auto2'].state == 'on')
              return `<ha-icon
                icon= "mdi:format-color-text"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Auto 45-65°C (A 6 5 2:30)`
            else if (states['switch.opvaskemaskine_program_eco50'].state == 'on')
              return `<ha-icon
                icon= "mdi:cash-multiple"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Eco 50°C ( N 4 4 3:15)`
            else if (states['switch.opvaskemaskine_program_nightwash'].state == 'on')
              return `<ha-icon
                icon= "mdi:ear-hearing-off"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Silence 50°C (N 4 4 3:55)`
            else if (states['switch.opvaskemaskine_program_kurz60'].state == 'on')
              return `<ha-icon
                icon= "mdi:coffee"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Kort 60°C (N 5 5 1:20)`
            else if (states['switch.opvaskemaskine_program_glas40'].state == 'on')
              return `<ha-icon
                icon= "mdi:glass-wine"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Glas 40°C (N 5 3 1:40)`
            else if (states['switch.opvaskemaskine_program_quick45'].state == 'on')
              return `<ha-icon
                icon= "mdi:flash"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Lyn 45°C ( L 4 3 0:30)`
            else if (states['switch.opvaskemaskine_program_machinecare'].state == 'on')
              return `<ha-icon
                icon= "mdi:calendar-star"
                style="width: 100px; height: 100px; color: blue;">
                </ha-icon></br>Maskinpleje`
            else
              return '';
          ]]]
        progress: |
          [[[
            if (states['switch.opvaskemaskine_program_active'].state == 'on')
            {
              var prog = 0;
              var totalprog = parseInt(states['sensor.opvaskemaskine_program_progress'].state);
              var out ='|';
              for (prog = 0; prog < totalprog/3; prog++)
              {
                out = out +'|';
              }
              for (prog = 0; prog < (100 -totalprog)/3; prog++)
              {
                out = out +' ';
              }
              return out + ': ' +totalprog + ' %';
            }
            else
              return '';
          ]]]
      styles:
        custom_fields:
          power:
            - position: absolute
            - top: 6%
            - left: 7%
            - color: red
            - font-size: 30px
          finish_time:
            - position: absolute
            - top: 6%
            - left: 40%
            - color: red
            - font-size: 30px
          program:
            - position: absolute
            - top: 30%
            - left: 25%
            - color: blue
            - font-size: 20px
          progress:
            - position: absolute
            - top: 60%
            - left: 25%
            - color: blue
            - font-size: 20px
      state:
        - value: 'on'
          entity_picture: >-
            https://www.auktionshuset.dk/thumbs/1280x720/images/RVz0ALE6Wr/M15jalp0J2/a346b1ad4716e12e31a5ce2130fa0a892486614d.jpeg
        - value: 'off'
          entity_picture: >-
            https://dahvid.dk/media/catalog/product/cache/a7e8e8c913fe4b81adc7fa066f0855c2/a/e/aeg_opvaskemaskine_ffb53640zw_1.jpg_aitseo/0/siemens-opvaskemaskine-sn478s36ts.jpg
    conditions:
      - entity: switch.opvaskemaskine_ready_for_program_activation
        state: 'off'
    type: conditional
type: vertical-stack

That is it.

Try it and let me know how far you come, and if you have any challenges or need to do minor modifications

If you are not living in central Europe you will need to modify the finsh time by adding/subrtracting another number of hours from UTC time. I’ll guide you if this is the case.

Good luck :slight_smile:

Hi
Just bought Bosch dishwasher, but don’t know how to add integration

{
  "error": "unauthorized_client",
  "error_description": "client or redirection URI not authorized",
  "state": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmbG93X2lkIjoiMzI4MGJhOWIwYmI5NGQ2Mjk4YTIzNTk4OTI3N2U0NGEiLCJyZWRpcmVjdF91cmkiOiJodHRwczovL2Rva3RvcmRvYy5kdWNrZG5zLm9yZy9hdXRoL2V4dGVybmFsL2NhbGxiYWNrIn0.oibhfX7Ufn0l2vnUlL7qpM96cT2GTxrjArxnUJK1Gk8"
}

shows this error when i try to add integration

Hi Sasa,
Please tell more about what you have done so far.and with details on how you did.

Did you follow the guide https://www.home-assistant.io/integrations/home_connect/

Have you created a home connect developer account, an application with related client Id and secret and added these to a home connect section in your configuration.yaml?

Which home assistant url are you using for the redirect URI?

Kind regards,
Ghassan

hi
thx for helping, sorry for bad english
i follow the guide, created a home connect developer acc., create app and then added in config.yaml - secret and id
not sure what i should write to redirect URI, i connect to HA with duck.dns, how should that looklike,
http://xxxxxxx.duckdns.org:8123/auth/external/callback or
https://xxxxxxx.duckdns.org:8123/auth/external/callback or something else

have you configured the internal and external urls in Home assistant under settings | general at the bottom of the page? it is one of these you can use for the “Redirect URI”

can you reach your home assistant externally over the internet using : http://xxxxxxx.duckdns.org:8123

If so, use this as the externa url at setting | general.

for internal url use your home assistant LAN ip address like http://YYYYY::8123

Hope this helps :slight_smile:

only external
what to put under internal

see my updated reply above.

If this still don’t work, try using using http://xxxxxxx.duckdns.org:8123 for the internal URL as well, on the settings general page.

no luck, same error
how should redirect URI look like on the end
…/auth/external/callback ?

did it
in settings put https://xxxxxxx.duckdns.org, with s, without 8123, why is that
thx so much

Hi,

just pasted the code and a part is working.
But still have some issues.
When I look at your 2nd picture then I don’t see the icons on my card
For me they all show a flash symbol

also a picture url is not working for me

can you check what can be wrong?

Hey Marc,
for picture 2 you need for each of your entities representing these programs to set the user-friendly name and icon.
You can do that from the settings | integrations then click on entities under Home Connect

then for each each of these entities:
switch.opvaskemaskine_program_intensiv70
switch.opvaskemaskine_program_auto2
switch.opvaskemaskine_program_eco50
switch.opvaskemaskine_program_nightwash
switch.opvaskemaskine_program_kurz60
switch.opvaskemaskine_program_glas40
switch.opvaskemaskine_program_quick45
switch.opvaskemaskine_program_machinecare

click and set userfriendly name and icon like this

for inspiration I used these icons
switch.opvaskemaskine_program_intensiv70 : mdi:pot
switch.opvaskemaskine_program_auto2 mdi:format-color-text
switch.opvaskemaskine_program_eco50 mdi:cash-multiple
switch.opvaskemaskine_program_nightwash mdi:ear-hearing-off
switch.opvaskemaskine_program_kurz60 mdi:coffee
switch.opvaskemaskine_program_glas40 mdi:glass-wine
switch.opvaskemaskine_program_quick45 mdi:flash
switch.opvaskemaskine_program_machinecare mdi:calendar-star

Be ware these are used in the code for the lovelace card too. You have to make sure you use same icon and name both places.

Which picture don’t work for you?

/Ghassan

Hi Sasa,

I use same IP address including the port nr for both internal and external except that the internal is without S

HA url settings

It has to be the full path needed to access your setup over the internet.
(The home connect server uses it to reach your setup over the internet)

Do you already access your setup from the mobile app over the internet? What address do you use there,(app configuration | connections external web address)
use that for the external (and internal) url in Configuration | General.

and use the same url + /auth/external/callback for the redirect URI of your home connect application at https://developer.home-connect.com

Hope this helps :slight_smile:

Thx for help
Appreciate

Thanks,

found it now it is working!
another question for the different programs you are indicating for example (N 4 4 3:15)
3:15 is time
but what does N 4 4 means?

Sounds great :slight_smile:

S/N/L indicating which level of dish dirtiness the program suits::
S (much)
N : Normal
L : low
you can change these as you like it is just info

Then the water economy level, a number between 1 and 9 ( 1 is the most economical)
Then electricity economy, also a number between 1 and 9.

Are you also living in central Europe or you need to adjust the finish time to another time zone?

Ha ok
I took the manual and I gone write down the number of electricity and water.
I’m from belgium, I already checked the finish time and it looks fine.

Next project is my siemens washing machine.
But new I have a nice example!

maybe last question, are you able to turn start the machine in HA?
i can do a power on, but I don’t think i can start it remote.
Maybe I have to experiment bit with the remote remote start.

thanks for all the explanation

Hey arc,

in order to start the machine from HA you have to:

  1. Open machine
    2: Turn power on
    3: Enable remote start/control
    4: close door

Now you should get the image i HA where you can start a program by simply clicking on it.

Be aware that remote start/control is disabled every time you open the machine door, So you have to enable it again every time you want to use it.

I am thinking of adding images indicating which part of the washing process is reached under the progress bare. For that I need information on that based on program and progress %. I’ll be happy to du that, but I am not sure i can find that information and it will take much time to watch and note these information running the different programs.

Anyway, try and let me know if you succeed :slight_smile:

Hi marc,
i made an improvement and a bug fix.

I found out that there is a binary sensor that indicates whether remote control is enabled, I use this as additional condition besides power on and door closed to control whether program selection is shown. this correction is for the code in configuration.yaml

      opvaskemaskine_ready_for_program_activation:
        value_template: >
          {{ is_state('switch.opvaskemaskine_power', 'on') and 
          is_state('binary_sensor.opvaskemaskine_remote_start', 'on') and 
          is_state('binary_sensor.opvaskemaskine_door', 'off') and 
          is_state('switch.opvaskemaskine_program_chosen', 'off')}}
        turn_on:
        turn_off:

and there was a bug calculating finish time if between 0:00 and 0:59. this is corrected in the following section in the lovelace card code:

        finish_time: |
          [[[ 
            if (states['switch.opvaskemaskine_program_active'].state == 'on')
            {
              var hour = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(11,2));;
              hour = hour + 1;
              var minute = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(14,2));
              var second = parseInt(states['sensor.opvaskemaskine_remaining_program_time'].state.substr(17,2));
              if (second > 30)
                minute = minute + 1;
              if (minute > 59)
              {
                minute = minute - 60;
                hour = hour + 1;
              }
              if (hour > 23)
                hour = hour - 24;  
              return hour + ':' + minute;
            }
            else
              return '';
          ]]]

Kind regards,
Ghassan

I have HC-enabled Bosch oven and via its official app I can switch on-off oven internal lights. However, I couldn’t find appropriate method\state in the dev documentation - only Hoods have Light parameter. Has anybody managed to integrate oven light?

Hello my friends,

I have a question if I may. Is there a way to enable remote start on machines permanently? Would like to turn things on from HA when I need them but not to go every time to the appliance and turn it on and enable remote start.
This would be greatly appreciated :slight_smile:

I have a Bosch washing machine and I’m finding that when I power it off, HA still reports it as being powered on.

Does this happen to anyone else?