How to rewrite a sensor in my configuration to use the new code method (2023.8.0)?

Below is the sensor I am trying to rewrite:

sensor:
  # - platform: "mqtt"
  #   name: "Washer Status"
  #   state_topic: "house/washer/status"
  # - platform: "mqtt"
  #   name: "Washer Last Complete"
  #   state_topic: "house/washer/time_complete"
  #   device_class: timestamp
  # - platform: "mqtt"
  #   name: "Washer Last Emptied"
  #   state_topic: "house/washer/time_emptied"
  #   device_class: timestamp

  # One entry for each beacon you want to track
  - platform: mqtt_room
    device_id: "apple:1006:10-8"
    name: "Westons iPhone Room Presence"
    state_topic: "espresense/devices/apple:1006:10-8"
    timeout: 10
    away_timeout: 120

Thank you all in advance for your assistance!!

There are examples in the docs.

I apologize. I was referencing the wrong code snippet.

I meant to reference this one after looking into the error message a little deeper.

sensor:
  - platform: command_line
    name: "Number of Lines of Code (YAML)"
    command: " find /config/ -name '*.yaml' | xargs cat | wc -l"

The answer is found in the docs also as Tom was saying.

Thank you again Tom and I apologize!

1 Like

Wouldn’t it be better to mark @tom_l’s post as the solution then? Give credit where credit is due and all .

True statement. Don’t disagree there. Will adjust shortly.

1 Like