Ring alarm integration - almost working. See cams and motion but not door sensors

Wondering if someone can give me some help on my Ring security alarm setup. Followed the MQTT / Ring installation docs and its showing camera feeds and motion. But, the door sensors and Alarm states are not showing on the main overview page.

The instructions I followed were:

1.) Install MQTT as an add-on and also as an integration.
Set to use local host. No configuration.yaml settings. Seems to be in separate config file now. Adding MQTT section to configuration.yaml results in HA booting to safe mode.

2.) Added Ring as an add-on w/ added github repository shown below and also as integration item. Prompted for 2FA and it worked.

Repo: https://github.com/rs1932/ring-alarm-hassio-addon


Have rebooted several times in case there is an at boot discovery going on. Saw others setups and their screen-shots are showing the door sensors. Mine are not showing. Odd that it even shows the battery sensors in the cameras. And it also shows the live camera feeds.

I donā€™t mind adding them manually if someone can steer me in the right direction.

Got it working. There was another Repo with an updated version of the ring integration that had a token setup. Everything now seems to be working.

Working repo for reference is:

1 Like

Hello,
I am new to using these platforms, do you mind sharing exactly what you put in the configuration.yaml file and the integration and configuration for the mqtt broker. I get the ring token generated but keep on getting errors when connecting to the broker. Thanks for your help in advance.

Ankur

Struggling w/ the .yaml entries also. Seems there is a new method in play now where addons use their own config files. In fact, the last few times Iā€™ve follwed instructions and add anything to the main .yaml file, it results in HA restarting in safe mode. But, if I go thru the method of installing as an addon or integration, there is usually a config option that asks for the username/pass etc. and it works there. As for where teh config files settings are saved, Iā€™m not sure, but found a similar question w/ possible answer at link below.

HA is powerful but takes so much time to debug and setup. I have had crappy experiences w/ SD cards in phones so soon Iā€™m going to research how to backup and restore from the backup. Donā€™t want to have to re-do everything.

I just have the mqtt in my main config yaml file

mqtt:
  broker: <my ip address for HA/MQTT broker>
  username: <my username>
  password: <my password>
  discovery: true
  discovery_prefix: homeassistant
  birth_message:
    topic: 'hass/status'
    payload: 'online'
    qos: 0
    retain: false

then in my Ring Hass.io addon config I have:

host: localhost
port: 1883
ring_topic: ring
hass_topic: hass/status
mqtt_user: <my username>
mqtt_pass: <my password>
ring_token: <my token>
enable_cameras: true
location_ids:
  - ''

input all the above values without the ā€œ< >ā€

Hi
I am new to home assistant. I am using smartthings for my home alarm at the moment. Wondering with this integration can you trigger an alarm event / unarm ring / arm ring with automations or scenes?

Thanks

Andy

Hi Folks,

I have searched however could not get the answer. Is there any way to use the Ring MQTT add on on a non PI device. My configuration is HA OS running on Virtual Box on Windows. I do have the MQTT broker setup. Any guidance would be appreciated.

Thanks

Super new here and trying to get a Standard install up and running. Everything seems to boot correctly and I get the following log entries but no devices ever show up. Thoughts?

ā€˜ā€™ā€™

| Ring Device Integration via MQTT |
| Addon for Home Assistant |
| |
| Report issues at: |

ring-mqtt.js version 4.5.7
Node version v14.17.3
NPM version 6.14.13
git version 2.26.3

Using discovered MQTT Host: core-mosquitto
Using discovered MQTT Port: 1883
Using discovered MQTT User: addons
Using discovered MQTT password:

Running ring-mqttā€¦
2021-07-20T00:02:45.250Z ring-mqtt Using configuration file: /data/options.json
2021-07-20T00:02:45.256Z ring-mqtt Reading latest data from state file: /data/ring-state.json
2021-07-20T00:02:45.385Z ring-mqtt Attempting connection to Ring API using saved refresh token.
2021-07-20T00:02:47.772Z ring-mqtt Connection to Ring API successful
2021-07-20T00:02:47.775Z ring-mqtt Starting connection to MQTT brokerā€¦
2021-07-20T00:02:47.880Z ring-mqtt File /data/ring-state.json saved with updated refresh token.
2021-07-20T00:02:47.894Z ring-mqtt MQTT connection established, processing locationsā€¦
2021-07-20T00:02:48.898Z ring-mqtt --------------------------------------------------------------------------------
2021-07-20T00:02:48.898Z ring-mqtt Found new location Seattle with id
ā€˜ā€™ā€™

Sorry noob question but i am moving from HomeKit to HA and i need someone to help point me to how i get my ring token so i can make this work

I Have decided to share here my experience and how I have managed to integrate Ring Alarm into Homme Assistant.

There are several topics on this subject but non was fully completed for me. May be someone else will find better explanations but just in case I prefer to share here also my settings. Letā€™s directly go to the installation process.

1/ Integration of Ring-MQTT with Video Streaming

The first 5 steps are nothing than what is given in the original installation of the github page. Here below the link to the Github page. But I will also repeat them here so you will have everything in one place.

1. Navigate to the add-on store in the Home Assistant UI (Settings in the left menu, then Add-on and finally Add on Store)
2. Select the three vertical dots in the upper right-hand corner and select repositories
3. In the Manage add-on repositories screen enter the URL for this projects Github page (GitHub - tsightler/ring-mqtt-ha-addon: Home Assistant addon to integrate Ring alarm and camera devices via MQTT) and click add
4. After adding the repository scroll to the bottom of the list of addons or use seach to find the addon
5. Select the addon and click the Install
6. Go to the ā€œConfigurationā€ Tab and leave all in default settings:
7. Comeback to the ā€œInfoā€ tab and click ā€œSTARTā€
8. Click on ā€œOPEN WEB UIā€ and you will be taken to a page where you have to enter your login and password of your Ring account.
9. Once you have done the previous step, a Token will be sent to your phone number that you have registered with your Ring account.
10. Paste that Token and you are done.

2/ Integration of Mosquitto Broker

Here we need to give some explanations. As Ring is not able to communicate directly, we need to have an intermediate server and a communication method. This is going to be Mqtt.

11. Go to Settings > ADD ON STORE >
12. Search for the ā€œMosquitto brokerā€ or Type ā€œMQTTā€
13. Click on ā€œINSTALLā€
14. In my case I have also enabled ā€œStart on bootā€ and ā€œWatchdogā€
15. Now click on ā€œSTARTā€
16. For now, Iā€™m using the autogenerated credentials.
17. Now I advise you to restart HA.
18. Once you have restarted go to Settings > Devices & Services
19. if you are lucky, HA will auto-discover the MQTT integration.
20. If the auto-discover didnā€™t work, just go to ā€œADD INTEGRATIONā€ and search for MQTT and add it.
21. In my case and for now I have left all the configuration of this integration in default settings.
22. Click on ā€œCONFIGURATIONā€ located in the bottom of the integration icon

23. In the new window that have popped-up, in the last section ā€œListen to a topicā€ just type ā€œ#ā€ and click on ā€œSTART LISTENINGā€

24. Wait for few mins and if your Ring Alarm is correctly communicating with the ā€œRingā€ app and all the system is connected to you LAN, MQTT messages will appear below.
25. Once all your messages are correctly received (depending on the number of equipment you have attached to your Ring base station), you can stop the listening process and come back to the ā€œDevices & Servicesā€ page.
26. Again if you have done all correctly, now in your Mosquitto broker integration logo, you should see the number of discovered ā€œdevicesā€ and ā€œentitiesā€.

image

27. Done,
28. Now as any device or entity you can see all your Ring Alarm connected devices, such as the base station, outdoor siren, indoor motion / door sensorsā€¦ You can use them to create your Alarm panel, battery levels of the sensors, automations etcā€¦

Here below is my Alarm panel settings. Iā€™m still not done with all sensors installation. I will post an update later. I Hope this will help more people. Almost all the entities and attributes you need to monitor and operate the Ring Alarm from HA are available. Thank you for the creator of this Integration.

8 Likes

Great directions Phil
How did you setup the layout in HA?
Thanks
Mark

Hi Mark,

What do you mean by Layout ? Do you mean the Lovelace dashboard ?
If the answer is Yes, I can share my full code here with all necessary integrations :slight_smile:

4 Likes

Thanks Phil
Simple setup instructions and took less than 5 minutes :smile:

Love the Lovelace card you have created. Any instructions on how you created? I need to spend some time sprucing up my dashboards. Would like to copy this as a starter.

Hi Phil used your guide and got the MQTT running ,but cannot find the alarm or any of the sensors .
Do I need to have the alarm connected to the LAN instead of WiFi or should it be able to work with the WiFi ?

Hi Phil
Iā€™m also interrested how you set up this Alarm Panel. Can you please share your Code etc.? Many thanks to you
Greetings
Tom

Hello Phil,

Would it be possible to share your code please ? I would really love an integration with this addon <3

Thanks !

Sorry for my late response, Iā€™ve been busy with some other work.

First of all here is a full view of my Alarm Dashboard. Here below I will put the code. You will need the Mashroom Lovelace theme + Card- mod (frontend in HACS) + Alarmo (integration in HACS).

When someone is detected by a senssor or if a window is open, then the corresponding card will light in orange. I also collect some information for each senssor, such as battery life time, the name, status etcā€¦

Here below the code for part 1:

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-title-card
        title: RING ALARM CARNOT
        subtitle: >-
          Last Communication: {{
          state_attr('sensor.your_base_station_info', 'lastCommTime') }}
  - type: custom:stack-in-card
    cards:
      - type: horizontal-stack
        cards:
          - type: custom:mushroom-alarm-control-panel-card
            entity: alarm_control_panel.your_alarm
            states:
              - armed_home
              - armed_away
            fill_container: false
            name: Ring Alarm Carnot
      - type: vertical-stack
        cards:
          - type: horizontal-stack
            cards:
              - type: custom:mushroom-template-card
                primary: Alarm State
                secondary: '{{state_attr(''sensor.your_alarm_info'', ''alarmState'')}}'
                icon: mdi:shield-home
                layout: horizontal
                icon_color: red
              - type: custom:mushroom-template-card
                primary: Alarm Tamper
                secondary: >-
                  {{state_attr('sensor.your_alarm_info',
                  'tamperStatus')}}
                icon: mdi:connection
                layout: horizontal
                icon_color: blue
  - type: horizontal-stack
    cards:
      - type: picture
        image: /local/images/ring_alarm_base.png
        tap_action:
          action: none
        hold_action:
          action: none
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: AC
        secondary: '{{ state_attr(''sensor.your_base_station_info'', ''acStatus'') }}'
        icon: mdi:power-plug
        layout: vertical
        icon_color: green
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Battery
        secondary: >-
          {{ state_attr('sensor.your_base_station_info', 'batteryStatus')
          }}
        icon: mdi:battery
        layout: vertical
        icon_color: cyan
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Bright
        secondary: '{{ state_attr(''sensor.your_base_station_info'', ''brightness'') }}'
        icon: mdi:brightness-7
        layout: vertical
        icon_color: orange
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Com
        secondary: '{{ state_attr(''sensor.your_base_station_info'', ''commStatus'') }}'
        icon: mdi:check-network
        layout: vertical
        icon_color: black
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Vol
        secondary: '{{ state_attr(''sensor.your_base_station_info'', ''volume'') }}'
        icon: mdi:speaker-multiple
        layout: vertical
        icon_color: red

Here below the code for part 2:

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-title-card
        title: RING ALARM SIREN
        subtitle: >-
          Tamper:  {% if is_state('binary_sensor.sirene_exterieure_tamper',
          'off') %}ok {% else %} Not ok {% endif %}
            
            
  - type: horizontal-stack
    cards:
      - type: custom:stack-in-card
        cards:
          - type: custom:mushroom-entity-card
            entity: number.sirene_exterieure_volume
          - type: picture
            image: /local/images/ring_sirene_ext2.png
            tap_action:
              action: none
            hold_action:
              action: none
          - type: custom:bar-card
            severity:
              - color: Red
                from: 0
                to: 20
              - color: Orange
                from: 21
                to: 50
              - color: lightGreen
                from: 51
                to: 100
            icon: mdi:battery
            columns: 4
            height: 40
            value: outside
            entities:
              - entity: sensor.sirene_exterieure_battery
                color: lightgreen
                max: 100
                direction: right
                name: Bat
            positions:
              icon: 'off'
              indicator: inside
              name: outside
            style: |-
              bar-card-value {
                margin-right: auto;
                font-size: 13px;
                font-weight: bold;
                color: darkgrey;
              }
            card_mod:
              style: |
                ha-card {
                  --ha-card-background: white;
                  color: var(--primary-color);
                }

                ha-card {
                  color: black;
                  font-weight: bold;
                }
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: AC
        secondary: '{{ state_attr(''sensor.sirene_exterieure_info'', ''acStatus'') }}'
        icon: mdi:power-plug
        layout: vertical
        icon_color: green
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Battery
        secondary: '{{ state_attr(''sensor.sirene_exterieure_info'', ''batteryStatus'') }}'
        icon: mdi:battery
        layout: vertical
        icon_color: cyan
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Bright
        secondary: '{{ state_attr(''sensor.sirene_exterieure_info'', ''brightness'') }}'
        icon: mdi:brightness-7
        layout: vertical
        icon_color: orange
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Com
        secondary: '{{ state_attr(''sensor.sirene_exterieure_info'', ''commStatus'') }}'
        icon: mdi:check-network
        layout: vertical
        icon_color: black
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Vol
        secondary: '{{ state_attr(''sensor.sirene_exterieure_info'', ''volume'') }}'
        icon: mdi:speaker-multiple
        layout: vertical
        icon_color: red
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-entity-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        entity: switch.sirene_exterieure
      - type: custom:mushroom-entity-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        entity: switch.your_siren

Here below the code for part 3:

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-title-card
        title: RING ALARM KEYPAD
        subtitle: >-
          Tamper:  {% if is_state('binary_sensor.ring_keypad_tamper',
          'off') %}ok {% else %} Not ok {% endif %}
            
            
  - type: horizontal-stack
    cards:
      - type: custom:stack-in-card
        cards:
          - type: custom:mushroom-entity-card
            entity: number.ring_keypad_volume
            name: Ring Keypad Volume
          - type: picture
            image: /local/images/ring_keypad.png
            tap_action:
              action: none
            hold_action:
              action: none
          - type: custom:bar-card
            severity:
              - color: Red
                from: 0
                to: 20
              - color: Orange
                from: 21
                to: 50
              - color: lightGreen
                from: 51
                to: 100
            icon: mdi:battery
            columns: 4
            height: 40
            value: outside
            entities:
              - entity: sensor.ring_keypad_info_template
                color: lightgreen
                max: 100
                direction: right
                name: Bat
            positions:
              icon: 'off'
              indicator: inside
              name: outside
            style: |-
              bar-card-value {
                margin-right: auto;
                font-size: 13px;
                font-weight: bold;
                color: darkgrey;
              }
            card_mod:
              style: |
                ha-card {
                  --ha-card-background: white;
                  color: var(--primary-color);
                }

                ha-card {
                  color: black;
                  font-weight: bold;
                }
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: AC
        secondary: '{{ state_attr(''sensor.ring_keypad_info'', ''powerSave'') }}'
        icon: mdi:power-plug
        layout: vertical
        icon_color: green
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Battery
        secondary: '{{ state_attr(''sensor.ring_keypad_info'', ''batteryStatus'') }}'
        icon: mdi:battery
        layout: vertical
        icon_color: cyan
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Bright
        secondary: '{{ state_attr(''sensor.ring_keypad_info'', ''brightness'') }}'
        icon: mdi:brightness-7
        layout: vertical
        icon_color: orange
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Com
        secondary: '{{ state_attr(''sensor.ring_keypad_info'', ''commStatus'') }}'
        icon: mdi:check-network
        layout: vertical
        icon_color: black
      - type: custom:mushroom-template-card
        card_mod:
          style: |
            ha-card {
              background: url('/local/images/lovelace-abstract-1.png');
              background-size: 100% 100%;
              # background-color: rgba(0,0,0,0);
              box-shadow: none;
            }
        primary: Vol
        secondary: '{{ state_attr(''sensor.ring_keypad_info'', ''volume'') }}'
        icon: mdi:speaker-multiple
        layout: vertical
        icon_color: red

Part 4 will be in the next post as Iā€™m limited to 36000 caracters per post.

Here below the code for part 4:
This part is the most difficult, because you also have to deal with card mod and you will have to type some code in your configuration file to creat a senssor to get your battery levels.

type: vertical-stack
cards:
  - type: horizontal-stack
    cards:
      - type: custom:mushroom-title-card
        title: RING ALARM MOTION SENSORS
        subtitle: >-
          Last Communication: {{
          state_attr('sensor.villemomble_base_station_info', 'lastCommTime') }}
  - type: horizontal-stack
    cards:
      - type: picture
        image: /local/images/Ring_motion_sensor.png
        tap_action:
          action: none
        hold_action:
          action: none
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        entity: binary_sensor.ring_motion_sensor_chambre_rdc
        icon: mdi:motion-sensor
        name: Chambre RDC
        show_name: false
        styles:
          card:
            - background-color: |
                [[[
                  if (states["binary_sensor.ring_motion_sensor_chambre_rdc"].state == 'on') return 'rgb(255, 183, 18)';
                  else return 'rgb(227, 228, 230)';
                ]]]
            - padding: 5%
            - color: black
            - font-size: 12px
            - font-weight: bold
            - text-transform: capitalize
          grid:
            - grid-template-areas: '"i battery_wifi" "name name" "status status" "info tamper " '
            - grid-template-columns: 1fr 1fr
            - grid-template-rows: 1fr min-content min-content min-content
          img_cell:
            - justify-content: start
            - align-items: start
            - margin: none
          icon:
            - color: |
                [[[
                  if (entity.state == 'off') return 'blue';

                  else return 'red';
                ]]]
            - width: 70%
            - margin-top: '-5%'
          custom_fields:
            battery_wifi:
              - align-self: start
              - justify-self: end
            name:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
            status:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if
                  (states["binary_sensor.ring_motion_sensor_chambre_rdc"].state
                  == "off") return  "blue"; ]]]
            info:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if
                  (states["sensor.ring_motion_sensor_chambre_rdc_battery"].state
                  > 80) return "red"; ]]]
            tamper:
              - align-self: bottom
              - justify-self: end
              - '--text-color-sensor': >-
                  [[[ if
                  (states["sensor.ring_motion_sensor_chambre_rdc_battery"].state
                  > 80) return "red"; ]]]
        custom_fields:
          battery_wifi: |
            [[[
              var battery = (states['sensor.ring_motion_sensor_chambre_rdc_battery'].attributes.batteryLevel);
              var battery_icon = (states['sensor.battery_percentagering_motion_sensor_chambre_rdc_template'].attributes.icon);
              var battery_icon_color = states['sensor.ring_motion_sensor_chambre_rdc_battery'].attributes.batteryLevel > '30' ? 'green' : 'red';
             
              return '</ha-icon> <ha-icon icon="' + battery_icon +'" style="width: 20px; height: 20px; color:' + battery_icon_color +';"></ha-icon>'
              + battery + '%'
            ]]]
          name: |
            [[[
              return `<ha-icon
                icon="mdi:rename-box"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Name: <span style="color: rgb(0, 0, 0);">Chambre RDC</span></span>`
            ]]]
          status: |
            [[[
              
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Status: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_chambre_rdc'].state}  </span></span>`
            ]]]
          info: |
            [[[
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Info: <span style="color: rgb(0, 0, 0);">${states['sensor.ring_motion_sensor_chambre_rdc_info'].state}</span></span>`
            ]]]
          tamper: |
            [[[
              return `<ha-icon
                icon="mdi:hand-back-left"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Tamper: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_chambre_rdc_tamper'].state}</span></span>`
            ]]]
      - type: custom:button-card
        entity: binary_sensor.ring_motion_sensor_salon
        icon: mdi:motion-sensor
        name: Chambre RDC
        show_name: false
        styles:
          card:
            - background-color: |
                [[[
                  if (states["binary_sensor.ring_motion_sensor_salon"].state == 'on') return 'rgb(255, 183, 18)';
                  else return 'rgb(227, 228, 230)';
                ]]]
            - padding: 5%
            - color: black
            - font-size: 12px
            - font-weight: bold
            - text-transform: capitalize
          grid:
            - grid-template-areas: '"i battery_wifi" "name name" "status status" "info tamper " '
            - grid-template-columns: 1fr 1fr
            - grid-template-rows: 1fr min-content min-content min-content
          img_cell:
            - justify-content: start
            - align-items: start
            - margin: none
          icon:
            - color: |
                [[[
                  if (entity.state == 'off') return 'blue';

                  else return 'red';
                ]]]
            - width: 70%
            - margin-top: '-5%'
          custom_fields:
            battery_wifi:
              - align-self: start
              - justify-self: end
            name:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
            status:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if (states["binary_sensor.ring_motion_sensor_salon"].state
                  == "off") return  "blue"; ]]]
            info:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if (states["sensor.ring_motion_sensor_salon_info"].state >
                  80) return "red"; ]]]
            tamper:
              - align-self: bottom
              - justify-self: end
              - '--text-color-sensor': >-
                  [[[ if (states["sensor.ring_motion_sensor_salon_info"].state >
                  80) return "red"; ]]]
        custom_fields:
          battery_wifi: |
            [[[
              var battery = (states['sensor.ring_motion_sensor_salon_info'].attributes.batteryLevel);
              var battery_icon = (states['sensor.battery_percentagering_motion_sensor_salon_template'].attributes.icon);
              var battery_icon_color = states['sensor.ring_motion_sensor_salon_info'].attributes.batteryLevel > '30' ? 'green' : 'red';
             
              return '</ha-icon> <ha-icon icon="' + battery_icon +'" style="width: 20px; height: 20px; color:' + battery_icon_color +';"></ha-icon>'
              + battery + '%'
            ]]]
          name: |
            [[[
              return `<ha-icon
                icon="mdi:rename-box"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Name: <span style="color: rgb(0, 0, 0);">Salon</span></span>`
            ]]]
          status: |
            [[[
              
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Status: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_salon'].state}  </span></span>`
            ]]]
          info: |
            [[[
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Info: <span style="color: rgb(0, 0, 0);">${states['sensor.ring_motion_sensor_salon_info'].state}</span></span>`
            ]]]
          tamper: |
            [[[
              return `<ha-icon
                icon="mdi:hand-back-left"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Tamper: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_salon_tamper'].state}</span></span>`
            ]]]
  - type: horizontal-stack
    cards:
      - type: custom:button-card
        entity: binary_sensor.ring_motion_sensor_entrance
        icon: mdi:motion-sensor
        name: EntrƩe RDC
        show_name: false
        styles:
          card:
            - background-color: |
                [[[
                  if (states["binary_sensor.ring_motion_sensor_entrance"].state == 'on') return 'rgb(255, 183, 18)';
                  else return 'rgb(227, 228, 230)';
                ]]]
            - padding: 5%
            - color: black
            - font-size: 12px
            - font-weight: bold
            - text-transform: capitalize
          grid:
            - grid-template-areas: '"i battery_wifi" "name name" "status status" "info tamper " '
            - grid-template-columns: 1fr 1fr
            - grid-template-rows: 1fr min-content min-content min-content
          img_cell:
            - justify-content: start
            - align-items: start
            - margin: none
          icon:
            - color: |
                [[[
                  if (entity.state == 'off') return 'blue';

                  else return 'red';
                ]]]
            - width: 70%
            - margin-top: '-5%'
          custom_fields:
            battery_wifi:
              - align-self: start
              - justify-self: end
            name:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
            status:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if
                  (states["binary_sensor.ring_motion_sensor_entrance"].state ==
                  "off") return  "blue"; ]]]
            info:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if
                  (states["sensor.ring_motion_sensor_entrance_battery"].state >
                  80) return "red"; ]]]
            tamper:
              - align-self: bottom
              - justify-self: end
              - '--text-color-sensor': >-
                  [[[ if
                  (states["sensor.ring_motion_sensor_entrance_battery"].state >
                  80) return "red"; ]]]
        custom_fields:
          battery_wifi: |
            [[[
              var battery = (states['sensor.ring_motion_sensor_entrance_battery'].attributes.batteryLevel);
              var battery_icon = (states['sensor.battery_percentagering_motion_sensor_entrance_template'].attributes.icon);
              var battery_icon_color = states['sensor.ring_motion_sensor_entrance_battery'].attributes.batteryLevel > '30' ? 'green' : 'red';
             
              return '</ha-icon> <ha-icon icon="' + battery_icon +'" style="width: 20px; height: 20px; color:' + battery_icon_color +';"></ha-icon>'
              + battery + '%'
            ]]]
          name: |
            [[[
              return `<ha-icon
                icon="mdi:rename-box"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Name: <span style="color: rgb(0, 0, 0);">EntrƩe RDC</span></span>`
            ]]]
          status: |
            [[[
              
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Status: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_entrance'].state}  </span></span>`
            ]]]
          info: |
            [[[
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Info: <span style="color: rgb(0, 0, 0);">${states['sensor.ring_motion_sensor_entrance_info'].state}</span></span>`
            ]]]
          tamper: |
            [[[
              return `<ha-icon
                icon="mdi:hand-back-left"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Tamper: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_entrance_tamper'].state}</span></span>`
            ]]]
      - type: custom:button-card
        entity: binary_sensor.ring_motion_sensor_salon
        icon: mdi:motion-sensor
        name: Chambre RDC
        show_name: false
        styles:
          card:
            - background-color: |
                [[[
                  if (states["binary_sensor.ring_motion_sensor_salon"].state == 'on') return 'rgb(255, 183, 18)';
                  else return 'rgb(227, 228, 230)';
                ]]]
            - padding: 5%
            - color: black
            - font-size: 12px
            - font-weight: bold
            - text-transform: capitalize
          grid:
            - grid-template-areas: '"i battery_wifi" "name name" "status status" "info tamper " '
            - grid-template-columns: 1fr 1fr
            - grid-template-rows: 1fr min-content min-content min-content
          img_cell:
            - justify-content: start
            - align-items: start
            - margin: none
          icon:
            - color: |
                [[[
                  if (entity.state == 'off') return 'blue';

                  else return 'red';
                ]]]
            - width: 70%
            - margin-top: '-5%'
          custom_fields:
            battery_wifi:
              - align-self: start
              - justify-self: end
            name:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
            status:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if (states["binary_sensor.ring_motion_sensor_salon"].state
                  == "off") return  "blue"; ]]]
            info:
              - padding-bottom: 2px
              - align-self: bottom
              - justify-self: start
              - '--text-color-sensor': >-
                  [[[ if (states["sensor.ring_motion_sensor_salon_info"].state >
                  80) return "red"; ]]]
            tamper:
              - align-self: bottom
              - justify-self: end
              - '--text-color-sensor': >-
                  [[[ if (states["sensor.ring_motion_sensor_salon_info"].state >
                  80) return "red"; ]]]
        custom_fields:
          battery_wifi: |
            [[[
              var battery = (states['sensor.ring_motion_sensor_salon_info'].attributes.batteryLevel);
              var battery_icon = (states['sensor.battery_percentagering_motion_sensor_salon_template'].attributes.icon);
              var battery_icon_color = states['sensor.ring_motion_sensor_salon_info'].attributes.batteryLevel > '30' ? 'green' : 'red';
             
              return '</ha-icon> <ha-icon icon="' + battery_icon +'" style="width: 20px; height: 20px; color:' + battery_icon_color +';"></ha-icon>'
              + battery + '%'
            ]]]
          name: |
            [[[
              return `<ha-icon
                icon="mdi:rename-box"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Name: <span style="color: rgb(0, 0, 0);">Salon</span></span>`
            ]]]
          status: |
            [[[
              
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Status: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_salon'].state}  </span></span>`
            ]]]
          info: |
            [[[
              return `<ha-icon
                icon="mdi:information"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Info: <span style="color: rgb(0, 0, 0);">${states['sensor.ring_motion_sensor_salon_info'].state}</span></span>`
            ]]]
          tamper: |
            [[[
              return `<ha-icon
                icon="mdi:hand-back-left"
                style="width: 19px; height: 19px; color: rgb(0, 0, 0);">
                </ha-icon><span>Tamper: <span style="color: rgb(0, 0, 0);">${states['binary_sensor.ring_motion_sensor_salon_tamper'].state}</span></span>`
            ]]]

Code to add in the configuration section
In my configuration file I call a file named ā€œsensorā€, maybe you have the senssor section directly in the configuration file. So just be careful where you paste the following code. Also Iā€™m just giving two as an example, because you just have to repeat the process for all of your sensors.

# Ring Alarm Sensor's battery levels

- platform: template
  sensors:
    battery_percentagering_motion_sensor_chambre_rdc_template:
      value_template: >-
        {{ state_attr('sensor.ring_motion_sensor_chambre_rdc_battery','batteryLevel') }}
      icon_template: >-
        {%- set batteryLevel = state_attr('sensor.ring_motion_sensor_chambre_rdc_battery','batteryLevel') -%}
        {% if batteryLevel <= 30 %}
          mdi:battery-alert
        {% elif batteryLevel > 30 and batteryLevel <= 40 %}
          mdi:battery-30
        {% elif batteryLevel > 40 and batteryLevel <= 50 %}
          mdi:battery-40
        {% elif batteryLevel > 50 and batteryLevel <= 60 %}
          mdi:battery-50
        {% elif batteryLevel > 60 and batteryLevel <= 70 %}
          mdi:battery-60
        {% elif batteryLevel > 70 and batteryLevel <= 80 %}
          mdi:battery-70
        {% elif batteryLevel > 80 and batteryLevel <= 90 %}
          mdi:battery-80
        {% elif batteryLevel > 90 %}
          mdi:battery
        {% endif %}

- platform: template
  sensors:
    battery_percentagering_motion_sensor_salon_template:
      value_template: >-
        {{ state_attr('sensor.ring_motion_sensor_salon_info','batteryLevel') }}
      icon_template: >-
        {%- set batteryLevel = state_attr('sensor.ring_motion_sensor_salon_info','batteryLevel') -%}
        {% if batteryLevel <= 30 %}
          mdi:battery-alert
        {% elif batteryLevel > 30 and batteryLevel <= 40 %}
          mdi:battery-30
        {% elif batteryLevel > 40 and batteryLevel <= 50 %}
          mdi:battery-40
        {% elif batteryLevel > 50 and batteryLevel <= 60 %}
          mdi:battery-50
        {% elif batteryLevel > 60 and batteryLevel <= 70 %}
          mdi:battery-60
        {% elif batteryLevel > 70 and batteryLevel <= 80 %}
          mdi:battery-70
        {% elif batteryLevel > 80 and batteryLevel <= 90 %}
          mdi:battery-80
        {% elif batteryLevel > 90 %}
          mdi:battery
        {% endif %}

Here below the code for part 5:

This is exactly the same as Part 4, so I will not add it here.

I Hope this process is clear for all of you. Please ask questions if you have any. Iā€™ll try my best to reply in time.

1 Like

Thank you so much, thatā€™s really complete :smiley: !!

You are really welcome and please do not hesitate if you have any question or if I forgot somthing.