Devices in the Google Home ecosystem can be implemented usingCloud-to-cloud,Matter, or both. Some device types are more complex than others, and present a challenge to develop when using the Home APIs in a way that permits smooth interfacing with other devices in the ecosystem.

One of the challenges in implementing some of these device types is that the devices can be composed of different combinations of traits. Not all combinations work as well as others. Also, theCloud-to-clouddata model maps to theMatterdata model, but not always in a clear, one-to-one fashion. See[Data model on Android](https://developers.home.google.com/apis/android/data-model), which discusses the data models and their mappings in more depth.

This page contains more information the data models for specific devices map to one another, and offers some guidance on which traits to use to implement those device types.

## Oven

The Oven ([`OvenDevice`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenDevice)) device type and its component traits are not as straightforward to implement compared to other device types. There are multiple ways to implement an Oven inMatter, but not all approaches result in seamless interoperation with other devices or with the Google Home ecosystem.

### Trait mapping

| **Caution:** The information that follows is subject to change. In the event that it does, Oven implementations and automations based on this guidance may cease to operate as required.

Rather than implementing aMatterOven device using the Oven Mode and On Off clusters, we recommend using the Oven Cavity Operational State cluster. This cluster is represented in the Home APIs by the[`OvenCavityOperationalState`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenCavityOperationalState)trait, and maps to theCloud-to-cloud[`RunCycle`](https://developers.home.google.com/cloud-to-cloud/traits/runcycle)trait. It defines phases such as "pre-heating", "pre-heated", and "cooling down".

|                                                                   Home APIs                                                                    |                                 Cloud-to-cloud                                  |
|:----------------------------------------------------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------:|
| [`OvenCavityOperationalState`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenCavityOperationalState) | [`RunCycle`](https://developers.home.google.com/cloud-to-cloud/traits/runcycle) |

There are limitations to theCloud-to-cloudOven data model. TheCloud-to-cloudOven data model only allows for a single chamber, with a single`RunCycle`. In contrast,Mattermodels a multi-chamber Oven as a device endpoint with an Oven Cavity Operational State cluster for each chamber.

For some Oven devices, it may be appropriate for the phase list to change at runtime. For example, Ovens that support preheating could have different entries in the phase list during the preheating phase than during the heating or cooldown phases.

### Recommended implementation

As discussed in the previous section, aMatterOven implementation should implement the Oven Cavity Operational State cluster, which is modeled in the Home APIs as the[`OvenCavityOperationalState`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenCavityOperationalState)trait.

For best results, ensure that yourCloud-to-cloudOven device implements the[`RunCycle`](https://developers.home.google.com/cloud-to-cloud/traits/runcycle)trait and publish the current state by setting the`currentRunCycle`attribute. This attribute is observable by the Home APIs through the[`OvenCavityOperationalState.phaseList`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenCavityOperationalState.Attribute#phaseList)and[`OvenCavityOperationalState.currentPhase`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OvenCavityOperationalStateTrait.Attributes#currentPhase())attributes.

The Oven device should also publish a run cycle device notification by updating the`priority`,`status`, and`currentCycleRemainingTime`attributes of`RunCycle`. The following example results in an[`OperationalState.OperationCompletion`](https://developers.home.google.com/reference/kotlin/com/google/home/matter/standard/OperationalStateTrait.OperationCompletion)event being sent, and can be used to indicate that the oven has transitioned from the 'pre-heating' cycle to the 'pre-heated' cycle:  

    {
      "currentRunCycle": [
        {
          "currentCycle": "pre-heating",
          "nextCycle": "pre-heated",
          "lang": "en"
        }
      ],
      "currentTotalRemainingTime": 1200,
      "currentCycleRemainingTime": 300
    }

| **Important:** The event publication should occur simultaneously with the actual device state change, or*immediately after* .**Don't send the event before the state change**.

### Use an Oven in an automation

When building an automation for an Oven implemented using the Oven Cavity Operational State cluster, reference the`currentPhase`attribute to know what cycle the oven is in:  

       sequential {
        val starterNode =
          starter<_>(oven, OvenDevice, OvenCavityOperationalState /* Or OperationalState */)
        condition {
          expression = starterNode.phaseList[operationalState.currentPhase.toUInt()] equals "pre-heated"
        }
        action(speaker, SpeakerDevice) {
        command(AssistantBroadcast.broadcast("Oven Cycle Complete"))
      }
      // Additional actions here as needed
    }

For a complete example, see[Blink the lights and announce when the oven reaches the chosen temperature](https://developers.home.google.com/apis/android/automation/examples#blink-lights).