"Meater Integration - API" - help making an automation better

Hi.

Have been using the Meater integration with a Meater probe. Works well and using the cloud to send data via an API to the entities in HA.

The integration brings in about 8 entities to HA. Once you setup the cook via the app, the entities come alive via the API from the app, otherwise, they are unavailable.

There are various stages of cooking from 5 minutes left, to ready for resting, resting and then done.I set up an automation to notify our Google speakers to annouce the various stages of the meat cooking process here:

alias: Notify when meat is done cooking
description: Meater TTS and Text notifications for cook.
trigger:
  - platform: numeric_state
    entity_id: sensor.meater_probe_remaining_time
    below: '6'
    id: five_minutes
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: done
    from: Resting
    to: Finished
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: ready for resting
    from: Started
    to: Ready For Resting
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: resting
    from: Ready For Resting
    to: Resting
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: five_minutes
        sequence:
          - service: tts.cloud_say
            data:
              entity_id: media_player.kitchen_display
              message: 5 more minutes untill your meat needs resting.
          - service: tts.cloud_say
            data:
              entity_id: media_player.family_room_display
              message: 5 more minutes untill your meat needs resting.
          - service: tts.cloud_say
            data:
              entity_id: media_player.basement_family_room
              message: 5 more minutes untill your meat needs resting.
          - service: notify.mobile_app_sony_xperia_zx1
            data:
              title: Meat is almost done
              message: 5 more minutes untill your meat needs resting.
      - conditions:
          - condition: trigger
            id: ready for resting
        sequence:
          - service: tts.cloud_say
            data:
              entity_id: media_player.kitchen_display
              message: Meat is cooked. Please remove from oven and let it rest.
          - service: tts.cloud_say
            data:
              entity_id: media_player.family_room_display
              message: Meat is cooked. Please remove from oven and let it rest.
          - service: tts.cloud_say
            data:
              entity_id: media_player.basement_family_room
              message: Meat is cooked. Please remove from oven and let it rest.
      - conditions:
          - condition: trigger
            id: resting
        sequence:
          - service: tts.cloud_say
            data:
              entity_id: media_player.kitchen_display
              message: Meat is now resting.
          - service: tts.cloud_say
            data:
              entity_id: media_player.family_room_display
              message: Meat is now resting.
          - service: tts.cloud_say
            data:
              entity_id: media_player.basement_family_room
              message: Meat is now resting.
      - conditions:
          - condition: trigger
            id: done
        sequence:
          - service: tts.cloud_say
            data:
              entity_id: media_player.kitchen_display
              message: Meat is cooked. Enjoy you meal!
          - service: tts.cloud_say
            data:
              entity_id: media_player.family_room_display
              message: Meat is cooked. Enjoy you meal!
          - service: tts.cloud_say
            data:
              entity_id: media_player.basement_family_room
              message: Meat is cooked. Enjoy you meal!
    default: []
mode: single

The above automation is ok, except for few things:

  1. The 5 minutes remaining trigger does not work because the sensor is not a numeric value, but a timestamp sensor:
sensor.meater_probe_elapsed_time
device_class: timestamp
friendly_name: Meater Probe Remaining time
  1. The actual meat you are cooking (i.e. beef, chicken, turkey, and their cuts etc. ) is shown in this sensor
sensor.meater_probe_cooking
friendly_name: Meater Probe Cooking

Here’s what I would like to try.

  1. How do I fix the time remaining triggern/part so that it annouces that 5 minutes is remaining?

  2. How to I include the value of the sensor into the broadcast message? for example rather than saying “you meat is done” can it say “Your {{sensor}} is done” where, the {{sensor}} is the value of sensor.meater_probe_cooking

I was thinking of doing the same automation in node red and writing a function so that the messages replace “Meat” with what’s cooking. I would imagine you need to convert the timestamp to a number either by way of another sensor or in a variable within a function (node red solution). I’m going to have a go at it this week

@Anto79-ops - I’ve actually resolved this and can’t take the credit for it. Hope this isn’t too long winded but if you integrate Meater via the API it will give you the sensors you want. Other than that you’ll need to convert the timestamp to seconds/minutes via building a new sensor. Just tested the node red flow on the elapsed time because the remaining time sensor is unavailble until the app calculates the time but both sensors are build the same. “Your Serloin steak is ready in 5 minutes!”. Other than that you’ll obviously need to build some logic in to only play once as otherwise it will play every time the sensor updates.

The cooktime remaining and elapsed will give you the time elapsed and remaining in seconds which are just attributes of the sensor that is built via the API



Hey @James_Hendry

thanks for this information! It sounds like its more straightforwared to do this in NodeRed (i.e. without creating a new sensor for the remianing time?). I may go that route, and just delete the part in the above automation for the remaining time.

I’ll give it a go…

I was thinking of inputing something like this in the value template of the automation trigger, this converts the value of the remaining entity into a number, haven’t had a cook yet, so don;t know if this will work…

  - platform: numeric_state
    entity_id: sensor.meater_probe_remaining_time
    below: '6'
    id: five_minutes
    value_template: >-
      {{((states('sensor.meater_probe_remaining_time')|as_timestamp -
      utcnow()|as_timestamp)/60)|round}}

Problem with what I mentioned above is that when the remaining time is not available, it throws errors in my log files. I presume a proper sensor would solve that problem, OK!

I’m trying to make this work here, the yaml checker doesn’t seem to like this entry:

- platform: template
  sensors:
    meater_meat_remaining time:
      value_template: {{((states('sensor.meater_probe_remaining_time')|as_timestamp - utcnow()|as_timestamp)/60)|round}}
      availability_template: >-
          {%- if not is_state("sensor.meater_probe_remaining_time", "unavailable") %}
            true
          {%- endif %}

I used the rest API instruction set I provided you which give you the sensors that you require. I’ve been playing with it and I’ve built out a few more Node Red flows after work this week. As advised I am using the elapsed sensor in my example as the remaining sensor only comes up when Meater provides a remaining time via the app. You can run the rest API and the official integration side by side no issues. I am sure you can convert it - I don’t know how. I also found Node Red very easy for limiting the amount of messages that can be sent after a trigger. You don’t want “Your Roast Chicken will be ready in 15 minues” over your Google Chrome every 30 seconds until the meat cooks!


1 Like

Thanks, @James_Hendry this is great information. I’m a big fan of NodeRed and use for many other type of notifications!

I had a cook yesterday, and my original automation worked well, except of course the error message in the logs untill the time remaining sensor became available, but there was no reptition of the messages, and it only happened once the trigger was met, the first time.

However, with some help from another forum member here, @Didgeridrew, we were able to get it all in one automation, and improve the message system using three sensors:

If you’re having a cook soon, give it try!

alias: Notify when meat is done cooking
description: Meater TTS and Text notifications for cook.
trigger:
  - platform: template
    value_template: >
      {% if states('sensor.meater_probe_remaining_time') not in ["unknown",
      "unavailable", "", none] %} {{ ((
      states('sensor.meater_probe_remaining_time') | as_timestamp  - utcnow() |
      as_timestamp) / 60) | round(0, 0) <= 5 }} {% endif %}
    id: five_minutes
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: done
    from: Resting
    to: Finished
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: ready_for_resting
    from: Started
    to: Ready For Resting
  - platform: state
    entity_id:
      - sensor.meater_probe_cook_state
    id: resting
    from: Ready For Resting
    to: Resting
condition: []
action:
  - variables:
      meat: >
        {% if states('sensor.meater_probe_cooking')  not in ["unknown",
        "unavailable", "", none] %} {{ states('sensor.meater_probe_cooking') }}
        {% else %} {{ "meat" }} {% endif %}
      messages:
        five_minutes: 5 more minutes until your {{meat}} needs resting.
        ready_for_resting: >-
          {{meat | capitalize }} is cooked. Please remove from heat and let it
          rest.
        resting: '{{meat | capitalize }} is now resting.'
        done: '{{meat | capitalize }} is cooked. Enjoy you meal!'
      message: '{{ messages.get( trigger.id ) }}'
  - service: tts.cloud_say
    data:
      message: '{{ message }}'
      entity_id:
        - media_player.kitchen_display
        - media_player.family_room_display
        - media_player.basement_family_room
  - condition: trigger
    id: five_minutes
  - service: notify.mobile_app_sony_xperia_zx1
    data:
      title: Meat is almost done
      message: '{{ message }}'
mode: single
2 Likes

Wow, super happy with this. Just implemented it into my setup and i’ll give it a try this weekend.
Thank you for all the effort and of course for sharing it with the community!

As a simple not-really-able-to-code use i’m so glad there’s people willing to share these beautiful solutions.

1 Like