If master-bedroom-ac is off automation

Hi all I’m having some trouble creating an automation.
here is what I’m tryin to accomplish:
if master-bedroom-ac is off then mppsolar-inverter-0 Change
inverter0_output_source_priority_select option is set to SBU else then
ppsolar-inverter-0 Change inverter0_output_source_priority_select option is
set to Utility first.
here is my YAML file

alias: if master-bedroom-ac is off
description: >-
  if master-bedroom-ac is off then mppsolar-inverter-0 Change
  inverter0_output_source_priority_select option is set to SBU else then
  ppsolar-inverter-0 Change inverter0_output_source_priority_select option is
  set to Utility first
mode: single
trigger:
  - platform: device
    device_id: bb7fe9e1a97632a10066960d5adc80fe
    domain: climate
    entity_id: climate.master_bedroom_ac
    type: hvac_mode_changed
condition: []
action:
  - if:
      - condition: device
        device_id: bb7fe9e1a97632a10066960d5adc80fe
        domain: climate
        entity_id: climate.master_bedroom_ac
        type: is_hvac_mode
        hvac_mode: 'off'
    then:
      - device_id: de6313df2cddf16b3469452252e64db3
        domain: select
        entity_id: select.inverter0_output_source_priority_select
        type: select_option
        option: Solar Battery Utility
    else:
      - device_id: de6313df2cddf16b3469452252e64db3
        domain: select
        entity_id: select.inverter0_output_source_priority_select
        type: select_option
        option: Utility first 

and I’m getting this error:
Message malformed: required key not provided @ data[‘to’]

thanks in advanced
Miguel

no answers to this one?

Its this that is giving you the issue in the trigger:

trigger:
  - platform: device
    device_id: bb7fe9e1a97632a10066960d5adc80fe
    domain: climate
    entity_id: climate.master_bedroom_ac
    type: hvac_mode_changed

But I tried with my device and it also errors. It seems odd that it generates that code in the UI but then barfs at saving it for the device trigger.

Just add this if you’re look for a specific mode trigger. If you want for ANY changes, you’ll probably need to change this to use a state on a entity instead of device I think.

    to: 

It sure seems like a UI bug to me. and its been around a while…

thank you
that was all I needed to add
to:

alias: if Livingroom-ac is off
description: >-
  if master-bedroom-ac is off then mppsolar-inverter-0 Change 
  inverter0_output_source_priority_select option is set to SBU else then 
  ppsolar-inverter-0 change inverter0_output_source_priority_select option is
  set to Utility first
trigger:
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: "off"
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: cool
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: dry
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: auto
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: fan_only
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: heat
  - platform: device
    device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
    domain: climate
    entity_id: climate.living_room_ac
    type: hvac_mode_changed
    to: heat_cool
  - type: value
    platform: device
    device_id: 3bd20c2c852b179557731154f2b668fc
    entity_id: sensor.soc
    domain: sensor
    below: 35
condition: []
action:
  - if:
      - condition: device
        device_id: f9ffa279d2e7dc4bcb56ca2e8c5a969f
        domain: climate
        entity_id: climate.living_room_ac
        type: is_hvac_mode
        hvac_mode: "off"
    then:
      - device_id: de6313df2cddf16b3469452252e64db3
        domain: select
        entity_id: select.inverter0_output_source_priority_select
        type: select_option
        option: Solar Battery Utility
    else:
      - device_id: de6313df2cddf16b3469452252e64db3
        domain: select
        entity_id: select.inverter0_output_source_priority_select
        type: select_option
        option: Utility first
  - if:
      - type: is_value
        condition: device
        device_id: 3bd20c2c852b179557731154f2b668fc
        entity_id: sensor.soc
        domain: sensor
        below: 35
    then:
      - device_id: de6313df2cddf16b3469452252e64db3
        domain: select
        entity_id: select.inverter0_output_source_priority_select
        type: select_option
        option: Utility first
    else: []
mode: single

now it works, I also added a condition that if my battery is less than 35% to stay in utility fist