text_sensor:
  - platform: modbus_controller
    modbus_controller_id: ${modbus_controller_id}
    device_id: ${device_id}
    name: "Anlagenzustand"
    id: ${lower_name}_Anlagenzustand
    register_type: read
    address: 4000
    raw_encode: HEXBYTES
    lambda: |-
      uint16_t value = modbus_controller::word_from_hex_str(x, 0);
      switch (value) {
        case 0: return std::string("Dauerlast");
        case 1: return std::string("Brauchwasser");
        case 2: return std::string("Automatik");
        case 3: return std::string("Scheitholzbetrieb");
        case 4: return std::string("Reinigen");
        case 5: return std::string("Ausgeschaltet");
        case 6: return std::string("Extraheizen");
        case 7: return std::string("Kaminkehrer");
        case 8: return std::string("Reinigen");
        default: return std::string("----");
      }
      return x;
