Message Malformed: Required Key not provided @ data[‘to’]
I get the above message if I try to build an automation where the trigger is when the mode of a climate device changes.
This happens using UI to build or if I try edits with yaml
I am on HA 2022.2.8
alias: AC not matched
description: notify with downstairs AC units are not in same mode
trigger:
- platform: device
device_id: 7e67e961440f39c6fb9874951cc0ead8
domain: climate
entity_id: climate.downstairs
type: hvac_mode_changed
You’re missing to:. That device trigger needs to know when to trigger. Right now it’s just saying trigger when the mode changes but it wants to know what hvac mode will cause the trigger.
If you want it to trigger off any hvac mode, you should use a state trigger instead.
I found an example of doing just that and the trigger is now working, now trying to get the conditions right. It would be nice if the ui would require that to: parameter
trigger:
- platform: state
entity_id: climate.downstairs
- platform: state
entity_id: climate.kitchen_ac
seems to be working now, i tried using entity based climate conditions and they would fail so I went to state based comparisons
alias: AC not matched
description: notify when downstairs ac units not in same mode
trigger:
- platform: state
entity_id: climate.downstairs
- platform: state
entity_id: climate.kitchen_ac
condition:
- condition: or
conditions:
- condition: and
conditions:
- condition: state
entity_id: climate.downstairs
state: heat
- condition: state
entity_id: climate.kitchen_ac
state: cool
- condition: and
conditions:
- condition: state
entity_id: climate.downstairs
state: cool
- condition: state
entity_id: climate.kitchen_ac
state: heat
action:
- service: notify.persistent_notification
data:
message: AC modes do not match {{ now().strftime('%H:%M %A %d %B %Y') }}
title: AC Mismatch
- service: notify.gmail_keith
data:
message: AC modes do not match {{ now().strftime('%H:%M %A %d %B %Y') }}
title: AC Mismatch
mode: single
got the same issue, the “to” field doesn’t show on the UI for the type “hvac_mode_changed” when using a device trigger, I have to add it in yaml mode, but it works fine with a state trigger