I have the following notification to notify me when my Litter Robot reports a status change. The problem is that the notification sends me the 3 letter status code that triggered it, when what I want it to do is send me the status description, which I was able to find here.
{
"state": {
"litterrobot__status_code": {
"br": "Bonnet Removed",
"ccc": "Clean Cycle Complete",
"ccp": "Clean Cycle In Progress",
"cd": "Cat Detected",
"csf": "Cat Sensor Fault",
"csi": "Cat Sensor Interrupted",
"cst": "Cat Sensor Timing",
"df1": "Drawer Almost Full - 2 Cycles Left",
"df2": "Drawer Almost Full - 1 Cycle Left",
"dfs": "Drawer Full",
"dhf": "Dump + Home Position Fault",
"dpf": "Dump Position Fault",
"ec": "Empty Cycle",
"hpf": "Home Position Fault",
"off": "Off",
"offline": "Offline",
"otf": "Over Torque Fault",
This file has been truncated. show original
When writing logs to the logbook it uses the status description instead of the status code. I’m wondering what the easiest way would be for it to deliver the translated status description in the notification instead of the status code.
alias: "Litter Robot Error Notification "
description: ""
trigger:
- platform: state
entity_id:
- sensor.virlr401_status_code
to:
- csf
- csi
- cst
- df1
- df2
- dfs
- dhf
- dpf
- hpf
- offline
- otf
- pd
- scf
- sdf
- spf
condition: []
action:
- service: notify.mobile_app_z_fold_3
metadata: {}
data:
title: Litter Robot Status Update
message: >-
message: "{{ trigger.to_state.name }}" turned "{{ trigger.to_state.state
}}."
mode: single
mekaneck
(Rick Auch)
April 26, 2024, 3:40am
2
You can just copy it all in and set it to a variable.
alias: "Litter Robot Error Notification "
description: ""
trigger:
- platform: state
entity_id:
- sensor.virlr401_status_code
to:
- csf
- csi
- cst
- df1
- df2
- dfs
- dhf
- dpf
- hpf
- offline
- otf
- pd
- scf
- sdf
- spf
condition: []
action:
- variables:
status_code_mapping: |
{
"br": "Bonnet Removed",
"ccc": "Clean Cycle Complete",
"ccp": "Clean Cycle In Progress",
"cd": "Cat Detected",
"csf": "Cat Sensor Fault",
"csi": "Cat Sensor Interrupted",
"cst": "Cat Sensor Timing",
"df1": "Drawer Almost Full - 2 Cycles Left",
"df2": "Drawer Almost Full - 1 Cycle Left",
"dfs": "Drawer Full",
"dhf": "Dump + Home Position Fault",
"dpf": "Dump Position Fault",
"ec": "Empty Cycle",
"hpf": "Home Position Fault",
"off": "Off",
"offline": "Offline",
"otf": "Over Torque Fault",
"p": "Paused",
"pd": "Pinch Detect",
"pwrd": "Powering Down",
"pwru": "Powering Up",
"rdy": "Ready",
"scf": "Cat Sensor Fault At Startup",
"sdf": "Drawer Full At Startup",
"spf": "Pinch Detect At Startup"
}
- service: notify.mobile_app_z_fold_3
metadata: {}
data:
title: Litter Robot Status Update
message: >-
{{ trigger.to_state.name ~ ' turned ' ~
status_code_mapping[trigger.to_state.state] ~ '.' }}
mode: single
Thanks! That makes a lot of sense. I’m still having trouble rendering the notification message though.
service: notify.mobile_app_z_fold_3
metadata: {}
data:
title: Litter Robot Status Update
message: >-
Litter Robot "{{ status_code_mapping[trigger.to_state.state] }}"
This just returns
Litter Robot ""
mekaneck
(Rick Auch)
April 26, 2024, 10:57pm
4
Remove the quotes. They are only needed for single-line templates.
message: >-
Litter Robot {{ status_code_mapping[trigger.to_state.state] }}
Hmm, this just returns.
Litter Robot
Thanks again for your help
alias: "Litter Robot Error Notification "
description: ""
trigger:
- platform: state
entity_id:
- sensor.virlr401_status_code
to:
- csf
- csi
- cst
- df1
- df2
- dfs
- dhf
- dpf
- hpf
- offline
- otf
- pd
- scf
- sdf
- spf
condition: []
action:
- variables:
status_code_mapping: |
{
"br": "Bonnet Removed",
"ccc": "Clean Cycle Complete",
"ccp": "Clean Cycle In Progress",
"cd": "Cat Detected",
"csf": "Cat Sensor Fault",
"csi": "Cat Sensor Interrupted",
"cst": "Cat Sensor Timing",
"df1": "Drawer Almost Full - 2 Cycles Left",
"df2": "Drawer Almost Full - 1 Cycle Left",
"dfs": "Drawer Full",
"dhf": "Dump + Home Position Fault",
"dpf": "Dump Position Fault",
"ec": "Empty Cycle",
"hpf": "Home Position Fault",
"off": "Off",
"offline": "Offline",
"otf": "Over Torque Fault",
"p": "Paused",
"pd": "Pinch Detect",
"pwrd": "Powering Down",
"pwru": "Powering Up",
"rdy": "Ready",
"scf": "Cat Sensor Fault At Startup",
"sdf": "Drawer Full At Startup",
"spf": "Pinch Detect At Startup"
}
- service: notify.mobile_app_z_fold_3
metadata: {}
data:
title: Litter Robot Status Update
message: Litter Robot {{ status_code_mapping[trigger.to_state.state] }}
mode: single
mekaneck
(Rick Auch)
April 26, 2024, 11:22pm
6
Sorry I formatted that wrong. It should have been a template:
variables:
status_code_mapping: |
{{
{
"br": "Bonnet Removed",
"ccc": "Clean Cycle Complete",
"ccp": "Clean Cycle In Progress",
"cd": "Cat Detected",
"csf": "Cat Sensor Fault",
"csi": "Cat Sensor Interrupted",
"cst": "Cat Sensor Timing",
"df1": "Drawer Almost Full - 2 Cycles Left",
"df2": "Drawer Almost Full - 1 Cycle Left",
"dfs": "Drawer Full",
"dhf": "Dump + Home Position Fault",
"dpf": "Dump Position Fault",
"ec": "Empty Cycle",
"hpf": "Home Position Fault",
"off": "Off",
"offline": "Offline",
"otf": "Over Torque Fault",
"p": "Paused",
"pd": "Pinch Detect",
"pwrd": "Powering Down",
"pwru": "Powering Up",
"rdy": "Ready",
"scf": "Cat Sensor Fault At Startup",
"sdf": "Drawer Full At Startup",
"spf": "Pinch Detect At Startup"
}
}}